[gnome-online-accounts/wip/rishi/templates: 1/10] daemon, provider, utils: Use g_key_file_unref instead g_key_file_free



commit 7ebaf9dcbdcc3a4d4d6ca7ffcdf328e283a4a392
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Aug 26 15:15:34 2016 +0200

    daemon, provider, utils: Use g_key_file_unref instead g_key_file_free
    
    The unref API is better because it makes it convenient to pass a
    GKeyFile around as long as we correctly ref/unref it at the right
    places. This will let us simplify some code in the subsequent commit.

 src/daemon/goadaemon.c       |    8 ++++----
 src/goabackend/goaprovider.c |    4 ++--
 src/goabackend/goautils.c    |    6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index b7cb639..58ec109 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -471,7 +471,7 @@ add_config_file (GoaDaemon     *self,
                      error->message, g_quark_to_string (error->domain), error->code);
         }
       g_error_free (error);
-      g_key_file_free (key_file);
+      g_key_file_unref (key_file);
     }
   else
     {
@@ -856,7 +856,7 @@ goa_daemon_reload_configuration (GoaDaemon *self)
   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_free);
+  g_list_free_full (key_files_to_free, (GDestroyNotify) g_key_file_unref);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -1051,7 +1051,7 @@ get_all_providers_cb (GObject      *source,
   g_free (group);
   g_free (id);
   g_free (path);
-  g_clear_pointer (&key_file, (GDestroyNotify) g_key_file_free);
+  g_clear_pointer (&key_file, (GDestroyNotify) g_key_file_unref);
   g_object_unref (data->daemon);
   g_object_unref (data->manager);
   g_object_unref (data->invocation);
@@ -1264,7 +1264,7 @@ on_account_handle_remove (GoaAccount            *account,
  out:
   g_clear_object (&provider);
   g_clear_object (&task);
-  g_clear_pointer (&key_file, (GDestroyNotify) g_key_file_free);
+  g_clear_pointer (&key_file, (GDestroyNotify) g_key_file_unref);
   g_free (group);
   g_free (path);
   return TRUE; /* invocation was handled */
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 26292f4..bae7343 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -1500,7 +1500,7 @@ goa_util_lookup_keyfile_string (GoaObject    *object,
     }
 
  out:
-  g_key_file_free (key_file);
+  g_key_file_unref (key_file);
   g_free (group);
   g_free (path);
   return ret;
@@ -1553,7 +1553,7 @@ goa_util_lookup_keyfile_boolean (GoaObject    *object,
     }
 
  out:
-  g_key_file_free (key_file);
+  g_key_file_unref (key_file);
   g_free (group);
   g_free (path);
   return ret;
diff --git a/src/goabackend/goautils.c b/src/goabackend/goautils.c
index 5f02b74..31bab2f 100644
--- a/src/goabackend/goautils.c
+++ b/src/goabackend/goautils.c
@@ -592,7 +592,7 @@ goa_utils_keyfile_remove_key (GoaAccount *account, const gchar *key)
     }
 
  out:
-  g_key_file_free (key_file);
+  g_key_file_unref (key_file);
   g_free (group);
   g_free (path);
 }
@@ -659,7 +659,7 @@ goa_utils_keyfile_set_boolean (GoaAccount *account, const gchar *key, gboolean v
     }
 
  out:
-  g_key_file_free (key_file);
+  g_key_file_unref (key_file);
   g_free (group);
   g_free (path);
 }
@@ -726,7 +726,7 @@ goa_utils_keyfile_set_string (GoaAccount *account, const gchar *key, const gchar
     }
 
  out:
-  g_key_file_free (key_file);
+  g_key_file_unref (key_file);
   g_free (group);
   g_free (old_value);
   g_free (path);


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