summaryrefslogtreecommitdiff
path: root/libnm-glib/nm-device-bridge.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2013-10-18 16:07:26 +0200
committerThomas Haller <thaller@redhat.com>2013-10-22 19:53:57 +0200
commit3eb1d5e9024108fe656476dc5a11fefd194d0c54 (patch)
treee59c0a5cef44de57babcf79784320092691a467e /libnm-glib/nm-device-bridge.c
parent1c93b24829d61e58624bf2dd20ebb34b3fceabea (diff)
downloadNetworkManager-3eb1d5e9024108fe656476dc5a11fefd194d0c54.tar.gz
core: cleanup freeing of glib collections of pointers
When freeing one of the collections such as GArray, GPtrArray, GSList, etc. it is common that the items inside the connections must be freed/unrefed too. The previous code often iterated over the collection first with e.g. g_ptr_array_foreach and passing e.g. g_free as GFunc argument. For one, this has the problem, that g_free has a different signature GDestroyNotify then the expected GFunc. Moreover, this can be simplified either by setting a clear function (g_ptr_array_set_clear_func) or by passing the destroy function to the free function (g_slist_free_full). Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'libnm-glib/nm-device-bridge.c')
-rw-r--r--libnm-glib/nm-device-bridge.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libnm-glib/nm-device-bridge.c b/libnm-glib/nm-device-bridge.c
index e632a9b2ea..2bec00fbfb 100644
--- a/libnm-glib/nm-device-bridge.c
+++ b/libnm-glib/nm-device-bridge.c
@@ -246,7 +246,7 @@ dispose (GObject *object)
g_clear_object (&priv->proxy);
if (priv->slaves) {
- g_ptr_array_foreach (priv->slaves, (GFunc) g_object_unref, NULL);
+ g_ptr_array_set_free_func (priv->slaves, g_object_unref);
g_ptr_array_free (priv->slaves, TRUE);
priv->slaves = NULL;
}