all: replace nm_unauto() by g_steal_pointer()

They do essentially the same.

(cherry picked from commit ba90c9601c)
This commit is contained in:
Thomas Haller 2016-05-12 14:28:34 +02:00
parent cd0dd3b0bf
commit b04db262cb
6 changed files with 6 additions and 18 deletions

View file

@ -945,7 +945,7 @@ _nm_setting_new_from_dbus (GType setting_type,
} }
} }
return nm_unauto (&setting); return g_steal_pointer (&setting);
} }
/** /**

View file

@ -206,7 +206,7 @@ _nm_vpn_editor_plugin_load (const char *plugin_name,
return NULL; return NULL;
} }
return nm_unauto (&editor_plugin); return g_steal_pointer (&editor_plugin);
} }
/** /**

View file

@ -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 static inline gpointer
nm_g_object_ref (gpointer obj) nm_g_object_ref (gpointer obj)
{ {

View file

@ -531,7 +531,7 @@ lldp_neighbor_new (sd_lldp_neighbor *neighbor_sd, GError **error)
neigh->valid = TRUE; neigh->valid = TRUE;
out: out:
return nm_unauto (&neigh); return g_steal_pointer (&neigh);
} }
static GVariant * static GVariant *
@ -694,7 +694,7 @@ process_lldp_neighbor (NMLldpListener *self, sd_lldp_neighbor *neighbor_sd, gboo
LOG_NEIGH_ARG (neigh)); LOG_NEIGH_ARG (neigh));
changed = TRUE; changed = TRUE;
g_hash_table_add (priv->lldp_neighbors, nm_unauto (&neigh)); g_hash_table_add (priv->lldp_neighbors, g_steal_pointer (&neigh));
done: done:
if (changed) if (changed)

View file

@ -224,7 +224,7 @@ nm_dns_plugin_child_spawn (NMDnsPlugin *self,
_LOGD ("%s started with pid %d", progname, pid); _LOGD ("%s started with pid %d", progname, pid);
priv->watch_id = g_child_watch_add (pid, (GChildWatchFunc) watch_cb, self); priv->watch_id = g_child_watch_add (pid, (GChildWatchFunc) watch_cb, self);
priv->pid = pid; priv->pid = pid;
priv->progname = nm_unauto (&progname); priv->progname = g_steal_pointer (&progname);
priv->pidfile = g_strdup (pidfile); priv->pidfile = g_strdup (pidfile);
return pid; return pid;

View file

@ -2612,7 +2612,7 @@ nm_utils_machine_id_read (void)
if (contents[i] != '\0') if (contents[i] != '\0')
return FALSE; return FALSE;
return nm_unauto (&contents); return g_steal_pointer (&contents);
} }
/*****************************************************************************/ /*****************************************************************************/