summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-06-25 08:25:26 +0200
committerThomas Haller <thaller@redhat.com>2019-06-26 09:53:54 +0200
commit03b8eb124e00f163d0c4baa8285f088727ef08e2 (patch)
tree29d718ec98c0e7d7753c01feea62cdbba73d6e4c
parent02ac5693d398519af42d59c3fc151cd692f6906e (diff)
downloadNetworkManager-03b8eb124e00f163d0c4baa8285f088727ef08e2.tar.gz
shared/glib: unconditionally redefine g_object_ref()/g_object_ref_sink() as typesafe macro
-rw-r--r--shared/nm-glib-aux/nm-glib.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/shared/nm-glib-aux/nm-glib.h b/shared/nm-glib-aux/nm-glib.h
index 77a0913899..bdb7ea5b3e 100644
--- a/shared/nm-glib-aux/nm-glib.h
+++ b/shared/nm-glib-aux/nm-glib.h
@@ -522,10 +522,18 @@ _nm_g_variant_new_printf (const char *format_string, ...)
/*****************************************************************************/
-#if !GLIB_CHECK_VERSION (2, 56, 0)
+/* Recent glib also casts the results to typeof(Obj), but only if
+ *
+ * ( defined(g_has_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56 )
+ *
+ * Since we build NetworkManager with older GLIB_VERSION_MAX_ALLOWED, it's
+ * not taking effect.
+ *
+ * Override this. */
+#undef g_object_ref
+#undef g_object_ref_sink
#define g_object_ref(Obj) ((typeof(Obj)) g_object_ref (Obj))
#define g_object_ref_sink(Obj) ((typeof(Obj)) g_object_ref_sink (Obj))
-#endif
/*****************************************************************************/