From 15be2bb3fd31a627e0ddb3cb10158b2ddd663abd Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 2 Sep 2020 17:40:38 +0200 Subject: [PATCH] shared: redefine "gs_*" cleanup macros to their "nm_auto*" counterparts --- shared/nm-glib-aux/nm-macros-internal.h | 100 +++--------------------- 1 file changed, 12 insertions(+), 88 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,94 +38,6 @@ /*****************************************************************************/ -/** - * 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" /*****************************************************************************/ @@ -134,6 +46,18 @@ NM_AUTO_DEFINE_FCN0 (GError *, gs_local_free_error, g_error_free); /*****************************************************************************/ +#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 + +/*****************************************************************************/ + NM_AUTO_DEFINE_FCN_VOID0 (void *, _nm_auto_g_free, g_free); #define nm_auto_g_free nm_auto(_nm_auto_g_free)