[glib] gio/gdbus-2.0/codegen/codegen.py: Use g_list_free_full()



commit dde3401122930355f665af25292ad1b639e98390
Author: Javier JardÃn <jjardon gnome org>
Date:   Mon Jan 2 16:09:50 2012 +0100

    gio/gdbus-2.0/codegen/codegen.py: Use g_list_free_full()

 gio/gdbus-2.0/codegen/codegen.py |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index af142e8..958a935 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -2330,8 +2330,7 @@ class CodeGenerator:
                          '    }\n'
                          %(i.name, s.name))
             self.c.write('  g_variant_unref (signal_variant);\n')
-            self.c.write('  g_list_foreach (connections, (GFunc)g_object_unref, NULL);\n')
-            self.c.write('  g_list_free (connections);\n')
+            self.c.write('  g_list_free_full (connections, g_object_unref);\n')
             self.c.write('}\n'
                          '\n')
 
@@ -2348,8 +2347,7 @@ class CodeGenerator:
         self.c.write('  %sSkeleton *skeleton = %s%s_SKELETON (object);\n'%(i.camel_name, i.ns_upper, i.name_upper))
         if len(i.properties) > 0:
             self.c.write('  g_value_array_free (skeleton->priv->properties);\n')
-        self.c.write('  g_list_foreach (skeleton->priv->changed_properties, (GFunc) _changed_property_free, NULL);\n')
-        self.c.write('  g_list_free (skeleton->priv->changed_properties);\n')
+        self.c.write('  g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);\n')
         self.c.write('  if (skeleton->priv->changed_properties_idle_source != NULL)\n')
         self.c.write('    g_source_destroy (skeleton->priv->changed_properties_idle_source);\n')
         self.c.write('  g_main_context_unref (skeleton->priv->context);\n')
@@ -2435,8 +2433,7 @@ class CodeGenerator:
                          '                                         NULL);\n'
                          '        }\n'
                          '      g_variant_unref (signal_variant);\n'
-                         '      g_list_foreach (connections, (GFunc)g_object_unref, NULL);\n'
-                         '      g_list_free (connections);\n'
+                         '      g_list_free_full (connections, g_object_unref);\n'
                          '    }\n'
                          '  else\n'
                          '    {\n'
@@ -2444,8 +2441,7 @@ class CodeGenerator:
                          '      g_variant_builder_clear (&invalidated_builder);\n'
                          '    }\n'
                          %(i.name))
-            self.c.write('  g_list_foreach (skeleton->priv->changed_properties, (GFunc) _changed_property_free, NULL);\n')
-            self.c.write('  g_list_free (skeleton->priv->changed_properties);\n')
+            self.c.write('  g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);\n')
             self.c.write('  skeleton->priv->changed_properties = NULL;\n')
             self.c.write('  skeleton->priv->changed_properties_idle_source = NULL;\n')
             self.c.write('  g_mutex_unlock (&skeleton->priv->lock);\n')



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