hal: Branch 'master' - 2 commits

Rob Taylor robtaylor at kemper.freedesktop.org
Thu Mar 13 07:25:13 PDT 2008


 hald/device_store.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

New commits:
commit d2b2baf9912b36def7856b6bfa5c60fc942bbcba
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Thu Mar 13 15:21:26 2008 +0100

    Add backwards compat wrapper for g_hash_table_get_keys
    
    We don't want to force a dependancy on GLib >= 2.14 yet, so this commit adds a
    compatbility wrapper for g_hash_table_get_keys when building with GLib < 2.14.

diff --git a/hald/device_store.c b/hald/device_store.c
index 66ad5f8..730e1f9 100644
--- a/hald/device_store.c
+++ b/hald/device_store.c
@@ -519,6 +519,23 @@ property_index_modify_string (HalDeviceStore *store, HalDevice *device,
 	g_hash_table_insert (index, (gpointer) value, devices);
 }
 
+#if GLIB_CHECK_VERSION (2,14,0)
+        /* Nothing */
+#else
+inline static void
+list_keys (gpointer key, gpointer value, GList **keys)
+{
+        *keys = g_list_append (*keys, key);
+}
+
+inline static GList*
+g_hash_table_get_keys (GHashTable *hash)
+{
+        GList *keys = NULL;
+        g_hash_table_foreach (hash, (GHFunc)list_values, &keys);
+        return keys;
+}
+#endif
 
 static void
 property_index_check_all (HalDeviceStore *store, HalDevice *device, gboolean added)
commit 581d3dadff6555ea96255fd328f2427ddc1f93b2
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Thu Mar 13 15:20:28 2008 +0100

    Fix memory leak in property_index_check_all
    
    We were failing the free the GList returned by g_hash_table_get_keys.

diff --git a/hald/device_store.c b/hald/device_store.c
index aff8f13..66ad5f8 100644
--- a/hald/device_store.c
+++ b/hald/device_store.c
@@ -531,5 +531,6 @@ property_index_check_all (HalDeviceStore *store, HalDevice *device, gboolean add
 			property_index_modify_string (store, device, lp->data, added);
 		}
 	}
+	g_list_free (indexed_properties);
 }
 


More information about the hal-commit mailing list