[gnome-online-accounts/wip/rishi/templates: 5/5] daemon: Remove the GList to track the GKeyFiles



commit dc041ad9a7281a84ba64bd89e533bc66537a24bd
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Aug 26 15:47:32 2016 +0200

    daemon: Remove the GList to track the GKeyFiles
    
    Thanks to the preceding commits, the GHashTable keeps its own
    references to the GKeyFiles and every relevant function drops any
    references that it might have taken. Hence there is no need to track
    them separately with a GList.

 src/daemon/goadaemon.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index 62dcc84..07d8eee 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -450,8 +450,7 @@ key_file_data_new (GKeyFile    *key_file,
 static void
 add_config_file (GoaDaemon     *self,
                  const gchar   *path,
-                 GHashTable    *group_name_to_key_file_data,
-                 GList        **key_files_to_free)
+                 GHashTable    *group_name_to_key_file_data)
 {
   GKeyFile *key_file;
   GError *error;
@@ -575,8 +574,6 @@ add_config_file (GoaDaemon     *self,
         }
     }
 
-  *key_files_to_free = g_list_prepend (*key_files_to_free, g_key_file_ref (key_file));
-
  out:
   g_key_file_unref (key_file);
 }
@@ -837,11 +834,9 @@ process_config_entries (GoaDaemon  *self,
 static void
 goa_daemon_reload_configuration (GoaDaemon *self)
 {
-  GList *key_files_to_free;
   GHashTable *group_name_to_key_file_data;
   gchar *path;
 
-  key_files_to_free = NULL;
   group_name_to_key_file_data = g_hash_table_new_full (g_str_hash,
                                                        g_str_equal,
                                                        g_free,
@@ -849,14 +844,13 @@ goa_daemon_reload_configuration (GoaDaemon *self)
 
   /* Read the main user config file at $HOME/.config/goa-1.0/accounts.conf */
   path = g_strdup_printf ("%s/goa-1.0/accounts.conf", g_get_user_config_dir ());
-  add_config_file (self, path, group_name_to_key_file_data, &key_files_to_free);
+  add_config_file (self, path, group_name_to_key_file_data);
   g_free (path);
 
   /* now process the group_name_to_key_file_data hash table */
   process_config_entries (self, group_name_to_key_file_data);
 
   g_hash_table_unref (group_name_to_key_file_data);
-  g_list_free_full (key_files_to_free, (GDestroyNotify) g_key_file_unref);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */


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