[gnome-terminal] profiles: Use the cleanup attribute to clean up



commit a7e40d3684b783dbad5881acf763030e2cf05305
Author: Christian Persch <chpe gnome org>
Date:   Mon Oct 21 17:55:46 2013 +0200

    profiles: Use the cleanup attribute to clean up

 src/terminal-profiles-list.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/terminal-profiles-list.c b/src/terminal-profiles-list.c
index d68545c..9da7654 100644
--- a/src/terminal-profiles-list.c
+++ b/src/terminal-profiles-list.c
@@ -23,6 +23,7 @@
 
 #include "terminal-profiles-list.h"
 #include "terminal-schemas.h"
+#include "terminal-libgsystem.h"
 
 #include <string.h>
 #include <uuid.h>
@@ -81,7 +82,6 @@ get_profile_names (TerminalSettingsList *list,
                    char ***profilesp,
                    char ***namesp)
 {
-  GSettings *profile;
   char **profiles, **names;
   guint i, n;
 
@@ -90,9 +90,10 @@ get_profile_names (TerminalSettingsList *list,
   n = g_strv_length (profiles);
   *namesp = names = g_new0 (char *, n + 1);
   for (i = 0; i < n; i++) {
+    gs_unref_object GSettings *profile;
+
     profile = terminal_settings_list_ref_child (list, profiles[i]);
     names[i] = g_settings_get_string (profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY);
-    g_object_unref (profile);
   }
 
   names[n] = NULL;
@@ -156,7 +157,7 @@ terminal_profiles_list_ref_profile_by_uuid (TerminalSettingsList *list,
                                             const char *uuid,
                                             GError **error)
 {
-  char *profile_uuid;
+  gs_free char *profile_uuid;
   GSettings *profile;
 
   profile_uuid = terminal_profiles_list_dup_uuid (list, uuid, error);
@@ -164,7 +165,6 @@ terminal_profiles_list_ref_profile_by_uuid (TerminalSettingsList *list,
     return NULL;
 
   profile = terminal_settings_list_ref_child (list, profile_uuid);
-  g_free (profile_uuid);
   g_assert (profile != NULL);
   return profile;
 }
@@ -225,7 +225,7 @@ terminal_profiles_list_ref_profile_by_uuid_or_name (TerminalSettingsList *list,
                                                     const char *uuid_or_name,
                                                     GError **error)
 {
-  char *uuid;
+  gs_free char *uuid;
   GSettings *profile;
 
   uuid = terminal_profiles_list_dup_uuid_or_name (list, uuid_or_name, error);
@@ -233,7 +233,6 @@ terminal_profiles_list_ref_profile_by_uuid_or_name (TerminalSettingsList *list,
     return NULL;
 
   profile = terminal_settings_list_ref_child (list, uuid);
-  g_free (uuid);
   g_assert (profile != NULL);
   return profile;
 }


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