summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-03-11 13:38:30 +0100
committerThomas Haller <thaller@redhat.com>2016-03-17 15:00:48 +0100
commit0330a55851652aedd75bf56f41e8a083b2a3be82 (patch)
treefa6f08e191dd067c142c3b4159ba8681c9e13ef1 /shared
parenta50d28d4dd28f7f41b831eac12e0f40b0464e8b7 (diff)
downloadNetworkManager-0330a55851652aedd75bf56f41e8a083b2a3be82.tar.gz
shared: add nm_unauto() helper macro
Diffstat (limited to 'shared')
-rw-r--r--shared/nm-macros-internal.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/shared/nm-macros-internal.h b/shared/nm-macros-internal.h
index 1eedadded9..e87539218d 100644
--- a/shared/nm-macros-internal.h
+++ b/shared/nm-macros-internal.h
@@ -315,6 +315,18 @@ _notify (obj_type *obj, _PropertyEnums prop) \
/*****************************************************************************/
+#define nm_unauto(pp) \
+ ({ \
+ G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \
+ gpointer *_pp = (gpointer *) (pp); \
+ gpointer _p = *_pp; \
+ \
+ *_pp = NULL; \
+ _p; \
+ })
+
+/*****************************************************************************/
+
static inline gpointer
nm_g_object_ref (gpointer obj)
{