about summary refs log tree commit diff
path: root/include/nm-glib-compat.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2012-06-29 20:12:44 +0200
committerMichael Biebl <biebl@debian.org>2012-06-29 20:12:44 +0200
commit867254ea7c2b193fecf8cd36cc6e5dc53c290d92 (patch)
tree7c698b403882736ab70c3efd524c3460f08c391c /include/nm-glib-compat.h
parentde06e5715e780baade318f3490ac7a4c9ce84e32 (diff)
Imported Upstream version 0.9.5.95 upstream/0.9.5.95
Diffstat (limited to 'include/nm-glib-compat.h')
-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 30b83e0d..3b772f4f 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 = (gpointer) (object_ptr); \
+		if (*__obj_p) { \
+			g_object_unref (*__obj_p); \
+			*__obj_p = NULL; \
+		} \
+	} G_STMT_END
+
 #endif
 
 #endif  /* NM_GLIB_COMPAT_H */