Index: glib/gkeyfile.c
===================================================================
RCS file: /cvs/gnome/glib/glib/gkeyfile.c,v
retrieving revision 1.27
diff -u -r1.27 gkeyfile.c
--- glib/gkeyfile.c	17 Mar 2005 19:28:15 -0000	1.27
+++ glib/gkeyfile.c	15 Apr 2005 07:21:34 -0000
@@ -80,6 +80,8 @@
   gchar list_separator;
 
   GKeyFileFlags flags;
+
+  guint ref_count;
 };
 
 typedef struct _GKeyFileKeyValuePair GKeyFileKeyValuePair;
@@ -619,6 +621,21 @@
 }
 
 /**
+ * g_key_file_ref:
+ * @key_file: a #GKeyFile
+ *
+ * Increases the reference count of a #GKeyFile by one.
+ **/
+void
+g_key_file_ref (GKeyFile *key_file)
+{
+  g_return_if_fail (key_file != NULL);
+  g_return_if_fail (key_file->ref_count > 0);
+
+  key_file->ref_count += 1;
+}
+
+/**
  * g_key_file_free:
  * @key_file: a #GKeyFile
  *
@@ -635,6 +652,25 @@
   g_free (key_file);
 }
 
+/**
+ * g_key_file_unref:
+ * @key_file: a #GKeyFile
+ *
+ * Decreases the reference count of a #GKeyFile by one.  If the reference count
+ * reaches zero, frees the key file and all its allocated memory.
+ **/
+void
+g_key_file_unref (GKeyFile *key_file)
+{
+  g_return_if_fail (key_file != NULL);
+  g_return_if_fail (key_file->ref_count > 0);
+
+  if (key_file->ref_count > 1)
+    key_file->ref_count -= 1;
+  else
+    g_key_file_free (key_file);
+}
+
 /* If G_KEY_FILE_KEEP_TRANSLATIONS is not set, only returns
  * true for locales that match those in g_get_language_names().
  */
Index: glib/gkeyfile.h
===================================================================
RCS file: /cvs/gnome/glib/glib/gkeyfile.h,v
retrieving revision 1.4
diff -u -r1.4 gkeyfile.h
--- glib/gkeyfile.h	28 Nov 2004 19:12:04 -0000	1.4
+++ glib/gkeyfile.h	15 Apr 2005 07:21:34 -0000
@@ -52,6 +52,8 @@
 
 GKeyFile *g_key_file_new                    (void);
 void      g_key_file_free                   (GKeyFile             *key_file);
+void      g_key_file_ref                    (GKeyFile             *key_file);
+void      g_key_file_unref                  (GKeyFile             *key_file);
 void      g_key_file_set_list_separator     (GKeyFile             *key_file,
 					     gchar                 separator);
 gboolean  g_key_file_load_from_file         (GKeyFile             *key_file,
