[gtk+/wip/ebassi/combo] optionlist: Use g_clear_pointer()



commit ded87c133defb7332ddb1f8b38bbada592d80c0b
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Aug 10 13:46:08 2015 +0100

    optionlist: Use g_clear_pointer()
    
    Instead of setting to NULL after calling g_free().

 gtk/gtkoptionlist.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkoptionlist.c b/gtk/gtkoptionlist.c
index fe86a58..dd18611 100644
--- a/gtk/gtkoptionlist.c
+++ b/gtk/gtkoptionlist.c
@@ -804,16 +804,14 @@ option_list_end_element (GMarkupParseContext *context,
     }
 
   data->translatable = FALSE;
-  g_string_set_size (data->string, 0);
-  g_free (data->context);
-  data->context = NULL;
-  g_free (data->id);
-  data->id = NULL;
-  g_free (data->sort);
-  data->sort = NULL;
-  g_free (data->group);
-  data->group = NULL;
   data->is_text = FALSE;
+
+  g_string_set_size (data->string, 0);
+
+  g_clear_pointer (&data->context, g_free);
+  g_clear_pointer (&data->id, g_free);
+  g_clear_pointer (&data->sort, g_free);
+  g_clear_pointer (&data->group, g_free);
 }
 
 static const GMarkupParser option_list_parser =


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