Commit 2f2beb16f67bfa6eb9576e25e43092afdbfdb1e8

Authored by Perry Werneck
1 parent 0b0e55cc
Exists in master and in 1 other branch develop

Trying to fix RHEL builds.

Showing 1 changed file with 33 additions and 0 deletions   Show diff stats
server/src/include/ipc-glib.h
... ... @@ -59,6 +59,39 @@
59 59 #include <gtk/gtk.h>
60 60 #include <lib3270.h>
61 61  
  62 +#if ! GLIB_CHECK_VERSION(2,44,0)
  63 +
  64 + LIB3270_EXPORT void ipc_3270_autoptr_cleanup_generic_gfree(void *p);
  65 +
  66 + #define g_autofree __attribute__((cleanup(ipc_3270_autoptr_cleanup_generic_gfree)))
  67 +
  68 + static inline void ipc_3270_autoptr_cleanup_GError(GError **error) {
  69 + if(*error) {
  70 + g_error_free(*error);
  71 + *error = NULL;
  72 + }
  73 + }
  74 +
  75 + static inline void ipc_3270_autoptr_cleanup_GObject(GObject **object) {
  76 + if(*object) {
  77 + g_object_unref(*object);
  78 + *object = NULL;
  79 + }
  80 + }
  81 +
  82 + static inline void ipc_3270_autoptr_cleanup_GVariant(GVariant **variant) {
  83 + if(*variant) {
  84 + g_variant_unref(*variant);
  85 + }
  86 + }
  87 +
  88 + #define IPC_3270_AUTOPTR_FUNC_NAME(TypeName) ipc_3270_autoptr_cleanup_##TypeName
  89 + #define g_autoptr(TypeName) TypeName * __attribute__ ((__cleanup__(IPC_3270_AUTOPTR_FUNC_NAME(TypeName))))
  90 +
  91 +#endif // ! GLIB(2,44,0)
  92 +
  93 +
  94 +
62 95 G_BEGIN_DECLS
63 96  
64 97 #define GLIB_TYPE_IPC3270_RESPONSE (ipc3270Response_get_type ())
... ...