From 4a084a2bcb7db351bdbe9e21e04c70b913fddee1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 2 Sep 2020 10:36:03 +0200 Subject: [PATCH] shared: rename "gs_local_option_context" to "nm_auto_free_option_context" The "gs_*" macros originate from the (no longer existing) libgsystem library. We still have them, because so far we didn't go through the effort of renaming the API. Aside that oddity, our cleanup API is called "nm_auto*". There is no need to add new API with the old name. --- shared/nm-glib-aux/nm-macros-internal.h | 11 +++-------- src/initrd/nm-initrd-generator.c | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index c61ef6525..407887146 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -141,14 +141,6 @@ NM_AUTO_DEFINE_FCN0 (GError *, gs_local_free_error, g_error_free); #define gs_unref_keyfile nm_auto(gs_local_keyfile_unref) NM_AUTO_DEFINE_FCN0 (GKeyFile *, gs_local_keyfile_unref, g_key_file_unref); -/** - * gs_free_option_context: - * - * Call g_option_context_free() on a variable location when it goes out of scope. - */ -#define gs_free_option_context nm_auto(gs_local_option_context) -NM_AUTO_DEFINE_FCN0 (GOptionContext *, gs_local_option_context, g_option_context_free); - /*****************************************************************************/ #include "nm-glib.h" @@ -208,6 +200,9 @@ NM_AUTO_DEFINE_FCN0 (GIOChannel *, _nm_auto_unref_io_channel, g_io_channel_unref NM_AUTO_DEFINE_FCN0 (GMainLoop *, _nm_auto_unref_gmainloop, g_main_loop_unref); #define nm_auto_unref_gmainloop nm_auto(_nm_auto_unref_gmainloop) +NM_AUTO_DEFINE_FCN0 (GOptionContext *, _nm_auto_free_option_context, g_option_context_free); +#define nm_auto_free_option_context nm_auto(_nm_auto_free_option_context) + static inline void _nm_auto_freev (gpointer ptr) { diff --git a/src/initrd/nm-initrd-generator.c b/src/initrd/nm-initrd-generator.c index 5a93480bf..d9f3280ec 100644 --- a/src/initrd/nm-initrd-generator.c +++ b/src/initrd/nm-initrd-generator.c @@ -83,7 +83,7 @@ main (int argc, char *argv[]) { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &remaining, NULL, NULL }, { NULL } }; - gs_free_option_context GOptionContext *option_context = NULL; + nm_auto_free_option_context GOptionContext *option_context = NULL; gs_free_error GError *error = NULL; gs_free char *hostname = NULL; int errsv;