summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-01-08 11:11:28 +0100
committerThomas Haller <thaller@redhat.com>2021-01-08 11:11:36 +0100
commit123765befcad75e1a77d2d8f0e2e1971b925c28e (patch)
tree91b4a75b08b45cc11c294d66f7ad8960b0f7b4e7
parent02f4b0cbd5c268c602a877a66923ad134d09e8ca (diff)
downloadNetworkManager-123765befcad75e1a77d2d8f0e2e1971b925c28e.tar.gz
shared: add code comment to nm_clear_g_object()
-rw-r--r--shared/nm-glib-aux/nm-macros-internal.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h
index 1fdf6999e4..4ce787ad1d 100644
--- a/shared/nm-glib-aux/nm-macros-internal.h
+++ b/shared/nm-glib-aux/nm-macros-internal.h
@@ -1038,6 +1038,14 @@ nm_g_object_unref(gpointer obj)
*/
#define nm_clear_g_free(pp) nm_clear_pointer(pp, g_free)
+/* Our nm_clear_pointer() is more typesafe than g_clear_pointer() and
+ * should be preferred.
+ *
+ * For g_clear_object() that is not the case (because g_object_unref()
+ * anyway takes a void pointer). So using g_clear_object() is fine.
+ *
+ * Still have a nm_clear_g_object() because that returns a boolean
+ * indication whether anything was cleared. */
#define nm_clear_g_object(pp) nm_clear_pointer(pp, g_object_unref)
/**