summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/nm-glib-compat.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h
index 30b83e0d55..e953f6ebcd 100644
--- a/include/nm-glib-compat.h
+++ b/include/nm-glib-compat.h
@@ -42,6 +42,16 @@
g_simple_async_result_set_from_error (result, __error); \
g_error_free (__error); \
} G_STMT_END
+
+#define g_clear_object(object_ptr) \
+ G_STMT_START { \
+ GObject **__obj_p = object_ptr; \
+ if (*__obj_p) { \
+ g_object_unref (*__obj_p); \
+ *__obj_p = NULL; \
+ } \
+ } G_STMT_END
+
#endif
#endif /* NM_GLIB_COMPAT_H */