[gupnp] More g_list_free_full



commit faeb36971e2ae972864a9da60351a498cb30ea07
Author: Jens Georg <mail jensge org>
Date:   Sun May 25 11:49:40 2014 +0200

    More g_list_free_full
    
    Signed-off-by: Jens Georg <mail jensge org>

 libgupnp/gupnp-network-manager.c       |    7 +------
 libgupnp/gupnp-service-introspection.c |   22 ++++++----------------
 2 files changed, 7 insertions(+), 22 deletions(-)
---
diff --git a/libgupnp/gupnp-network-manager.c b/libgupnp/gupnp-network-manager.c
index 3b4e424..f9c304e 100644
--- a/libgupnp/gupnp-network-manager.c
+++ b/libgupnp/gupnp-network-manager.c
@@ -714,12 +714,7 @@ gupnp_network_manager_dispose (GObject *object)
                 priv->manager_proxy = NULL;
         }
 
-        if (priv->nm_devices != NULL) {
-                g_list_foreach (priv->nm_devices, (GFunc) nm_device_unref,
-                    NULL);
-                g_list_free (priv->nm_devices);
-                priv->nm_devices = NULL;
-        }
+        g_list_free_full (priv->nm_devices, (GDestroyNotify) nm_device_unref);
 
         if (priv->cancellable != NULL)  {
                 g_object_unref (priv->cancellable);
diff --git a/libgupnp/gupnp-service-introspection.c b/libgupnp/gupnp-service-introspection.c
index bc19dcb..60de64d 100644
--- a/libgupnp/gupnp-service-introspection.c
+++ b/libgupnp/gupnp-service-introspection.c
@@ -95,10 +95,8 @@ gupnp_service_state_variable_info_free
                 g_value_unset (&variable->maximum);
                 g_value_unset (&variable->step);
         }
-        g_list_foreach (variable->allowed_values,
-                         (GFunc) g_free,
-                         NULL);
-        g_list_free (variable->allowed_values);
+
+        g_list_free_full (variable->allowed_values, g_free);
 
         g_slice_free (GUPnPServiceStateVariableInfo, variable);
 }
@@ -180,19 +178,11 @@ gupnp_service_introspection_finalize (GObject *object)
 
         introspection = GUPNP_SERVICE_INTROSPECTION (object);
 
-        if (introspection->priv->variables) {
-                g_list_foreach (introspection->priv->variables,
-                                (GFunc) gupnp_service_state_variable_info_free,
-                                NULL);
-                g_list_free (introspection->priv->variables);
-        }
+        g_list_free_full (introspection->priv->variables,
+                          (GDestroyNotify) gupnp_service_state_variable_info_free);
 
-        if (introspection->priv->actions) {
-                g_list_foreach (introspection->priv->actions,
-                                (GFunc) gupnp_service_action_info_free,
-                                NULL);
-                g_list_free (introspection->priv->actions);
-        }
+        g_list_free_full (introspection->priv->actions,
+                          (GDestroyNotify) gupnp_service_action_info_free);
 
         /* Contents don't need to be freed, they were owned by priv->variables
          */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]