summaryrefslogtreecommitdiff
path: root/shared/nm-glib-aux/nm-macros-internal.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-09-02 17:40:38 +0200
committerThomas Haller <thaller@redhat.com>2020-09-02 17:46:44 +0200
commit15be2bb3fd31a627e0ddb3cb10158b2ddd663abd (patch)
tree14a01816672c278a391e7ce852e597af787b3f29 /shared/nm-glib-aux/nm-macros-internal.h
parentc7a724fd5311bb8d776c64d980d13e85a3fb82a5 (diff)
downloadNetworkManager-15be2bb3fd31a627e0ddb3cb10158b2ddd663abd.tar.gz
shared: redefine "gs_*" cleanup macros to their "nm_auto*" counterparts
Diffstat (limited to 'shared/nm-glib-aux/nm-macros-internal.h')
-rw-r--r--shared/nm-glib-aux/nm-macros-internal.h98
1 files changed, 11 insertions, 87 deletions
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h
index bbab3a01b5..60cf52c384 100644
--- a/shared/nm-glib-aux/nm-macros-internal.h
+++ b/shared/nm-glib-aux/nm-macros-internal.h
@@ -38,99 +38,23 @@
/*****************************************************************************/
-/**
- * gs_free:
- *
- * Call g_free() on a variable location when it goes out of scope.
- */
-#define gs_free nm_auto(gs_local_free)
-NM_AUTO_DEFINE_FCN_VOID0 (void *, gs_local_free, g_free);
-
-/**
- * gs_unref_object:
- *
- * Call g_object_unref() on a variable location when it goes out of
- * scope. Note that unlike g_object_unref(), the variable may be
- * %NULL.
- */
-#define gs_unref_object nm_auto(gs_local_obj_unref)
-NM_AUTO_DEFINE_FCN_VOID0 (GObject *, gs_local_obj_unref, g_object_unref);
-
-/**
- * gs_unref_variant:
- *
- * Call g_variant_unref() on a variable location when it goes out of
- * scope. Note that unlike g_variant_unref(), the variable may be
- * %NULL.
- */
-#define gs_unref_variant nm_auto(gs_local_variant_unref)
-NM_AUTO_DEFINE_FCN0 (GVariant *, gs_local_variant_unref, g_variant_unref);
-
-/**
- * gs_unref_array:
- *
- * Call g_array_unref() on a variable location when it goes out of
- * scope. Note that unlike g_array_unref(), the variable may be
- * %NULL.
-
- */
-#define gs_unref_array nm_auto(gs_local_array_unref)
-NM_AUTO_DEFINE_FCN0 (GArray *, gs_local_array_unref, g_array_unref);
-
-/**
- * gs_unref_ptrarray:
- *
- * Call g_ptr_array_unref() on a variable location when it goes out of
- * scope. Note that unlike g_ptr_array_unref(), the variable may be
- * %NULL.
-
- */
-#define gs_unref_ptrarray nm_auto(gs_local_ptrarray_unref)
-NM_AUTO_DEFINE_FCN0 (GPtrArray *, gs_local_ptrarray_unref, g_ptr_array_unref);
-
-/**
- * gs_unref_hashtable:
- *
- * Call g_hash_table_unref() on a variable location when it goes out
- * of scope. Note that unlike g_hash_table_unref(), the variable may
- * be %NULL.
- */
-#define gs_unref_hashtable nm_auto(gs_local_hashtable_unref)
-NM_AUTO_DEFINE_FCN0 (GHashTable *, gs_local_hashtable_unref, g_hash_table_unref);
-
-/**
- * gs_unref_bytes:
- *
- * Call g_bytes_unref() on a variable location when it goes out
- * of scope. Note that unlike g_bytes_unref(), the variable may
- * be %NULL.
- */
-#define gs_unref_bytes nm_auto(gs_local_bytes_unref)
-NM_AUTO_DEFINE_FCN0 (GBytes *, gs_local_bytes_unref, g_bytes_unref);
-
-/**
- * gs_strfreev:
- *
- * Call g_strfreev() on a variable location when it goes out of scope.
- */
-#define gs_strfreev nm_auto(gs_local_strfreev)
-NM_AUTO_DEFINE_FCN0 (char **, gs_local_strfreev, g_strfreev);
-
-/**
- * gs_free_error:
- *
- * Call g_error_free() on a variable location when it goes out of scope.
- */
-#define gs_free_error nm_auto(gs_local_free_error)
-NM_AUTO_DEFINE_FCN0 (GError *, gs_local_free_error, g_error_free);
+#include "nm-glib.h"
/*****************************************************************************/
-#include "nm-glib.h"
+#define nm_offsetofend(t,m) (G_STRUCT_OFFSET (t,m) + sizeof (((t *) NULL)->m))
/*****************************************************************************/
-#define nm_offsetofend(t,m) (G_STRUCT_OFFSET (t,m) + sizeof (((t *) NULL)->m))
+#define gs_free nm_auto_g_free
+#define gs_unref_object nm_auto_unref_object
+#define gs_unref_variant nm_auto_unref_variant
+#define gs_unref_array nm_auto_unref_array
+#define gs_unref_ptrarray nm_auto_unref_ptrarray
+#define gs_unref_hashtable nm_auto_unref_hashtable
+#define gs_unref_bytes nm_auto_unref_bytes
+#define gs_strfreev nm_auto_strfreev
+#define gs_free_error nm_auto_free_error
/*****************************************************************************/