From b04db262cbf49238cea0f0a7dbf30dcc83ff5fc2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 12 May 2016 14:28:34 +0200 Subject: [PATCH] all: replace nm_unauto() by g_steal_pointer() They do essentially the same. (cherry picked from commit ba90c9601c44a507848359111830ff5d91ad1aa9) --- libnm-core/nm-setting.c | 2 +- libnm-core/nm-vpn-editor-plugin.c | 2 +- shared/nm-macros-internal.h | 12 ------------ src/devices/nm-lldp-listener.c | 4 ++-- src/dns-manager/nm-dns-plugin.c | 2 +- src/nm-core-utils.c | 2 +- 6 files changed, 6 insertions(+), 18 deletions(-) diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c index 0c41bd84c3..fcd8dff760 100644 --- a/libnm-core/nm-setting.c +++ b/libnm-core/nm-setting.c @@ -945,7 +945,7 @@ _nm_setting_new_from_dbus (GType setting_type, } } - return nm_unauto (&setting); + return g_steal_pointer (&setting); } /** diff --git a/libnm-core/nm-vpn-editor-plugin.c b/libnm-core/nm-vpn-editor-plugin.c index c4db3788e2..6c78c20983 100644 --- a/libnm-core/nm-vpn-editor-plugin.c +++ b/libnm-core/nm-vpn-editor-plugin.c @@ -206,7 +206,7 @@ _nm_vpn_editor_plugin_load (const char *plugin_name, return NULL; } - return nm_unauto (&editor_plugin); + return g_steal_pointer (&editor_plugin); } /** diff --git a/shared/nm-macros-internal.h b/shared/nm-macros-internal.h index 384bca66fe..e584b9d031 100644 --- a/shared/nm-macros-internal.h +++ b/shared/nm-macros-internal.h @@ -326,18 +326,6 @@ _notify (obj_type *obj, _PropertyEnums prop) \ /*****************************************************************************/ -#define nm_unauto(pp) \ - ({ \ - G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ - gpointer *_pp = (gpointer *) (pp); \ - gpointer _p = *_pp; \ - \ - *_pp = NULL; \ - _p; \ - }) - -/*****************************************************************************/ - static inline gpointer nm_g_object_ref (gpointer obj) { diff --git a/src/devices/nm-lldp-listener.c b/src/devices/nm-lldp-listener.c index 592059f55f..9cc1d08680 100644 --- a/src/devices/nm-lldp-listener.c +++ b/src/devices/nm-lldp-listener.c @@ -531,7 +531,7 @@ lldp_neighbor_new (sd_lldp_neighbor *neighbor_sd, GError **error) neigh->valid = TRUE; out: - return nm_unauto (&neigh); + return g_steal_pointer (&neigh); } static GVariant * @@ -694,7 +694,7 @@ process_lldp_neighbor (NMLldpListener *self, sd_lldp_neighbor *neighbor_sd, gboo LOG_NEIGH_ARG (neigh)); changed = TRUE; - g_hash_table_add (priv->lldp_neighbors, nm_unauto (&neigh)); + g_hash_table_add (priv->lldp_neighbors, g_steal_pointer (&neigh)); done: if (changed) diff --git a/src/dns-manager/nm-dns-plugin.c b/src/dns-manager/nm-dns-plugin.c index d5cb882246..6ab18faa9c 100644 --- a/src/dns-manager/nm-dns-plugin.c +++ b/src/dns-manager/nm-dns-plugin.c @@ -224,7 +224,7 @@ nm_dns_plugin_child_spawn (NMDnsPlugin *self, _LOGD ("%s started with pid %d", progname, pid); priv->watch_id = g_child_watch_add (pid, (GChildWatchFunc) watch_cb, self); priv->pid = pid; - priv->progname = nm_unauto (&progname); + priv->progname = g_steal_pointer (&progname); priv->pidfile = g_strdup (pidfile); return pid; diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c index ef44a13927..e7b50d60bb 100644 --- a/src/nm-core-utils.c +++ b/src/nm-core-utils.c @@ -2612,7 +2612,7 @@ nm_utils_machine_id_read (void) if (contents[i] != '\0') return FALSE; - return nm_unauto (&contents); + return g_steal_pointer (&contents); } /*****************************************************************************/