[gnome-builder] beautifier: use g_clear_pointer()



commit 59650e13e49656c98c358d37320cd31dad4bf7e6
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 10 19:30:36 2018 -0800

    beautifier: use g_clear_pointer()

 src/plugins/beautifier/gb-beautifier-config.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/beautifier/gb-beautifier-config.c b/src/plugins/beautifier/gb-beautifier-config.c
index e40804b..6dd9d7a 100644
--- a/src/plugins/beautifier/gb-beautifier-config.c
+++ b/src/plugins/beautifier/gb-beautifier-config.c
@@ -635,8 +635,7 @@ get_entries_worker (GTask        *task,
   add_entries_from_base_path (self, user_config_path, entries, map, &ret_has_default);
   has_default |= ret_has_default;
 
-  if (map != NULL)
-    g_array_free (map, TRUE);
+  g_clear_pointer (&map, g_array_unref);
 
   /* Project wide config */
   if (NULL != (context = self->context))
@@ -652,8 +651,7 @@ get_entries_worker (GTask        *task,
               has_default |= ret_has_default;
               g_clear_pointer (&configdir, g_free);
 
-              if (map != NULL)
-                g_array_free (map, TRUE);
+              g_clear_pointer (&map, g_array_unref);
             }
           else if (NULL != (vcs = ide_context_get_vcs (context)))
             {
@@ -669,8 +667,7 @@ get_entries_worker (GTask        *task,
               add_entries_from_base_path (self, project_config_path, entries, map, &ret_has_default);
               has_default |= ret_has_default;
 
-              if (map != NULL)
-                g_array_free (map, TRUE);
+              g_clear_pointer (&map, g_array_unref);
             }
         }
     }
@@ -683,8 +680,7 @@ get_entries_worker (GTask        *task,
   g_clear_pointer (&configdir, g_free);
   has_default |= ret_has_default;
 
-  if (map != NULL)
-    g_array_free (map, TRUE);
+  g_clear_pointer (&map, g_array_unref);
 
   result = g_slice_new0 (GbBeautifierEntriesResult);
   result->entries = entries;


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