summaryrefslogtreecommitdiffstats
path: root/security/seahorse/files/patch-common_seahorse-registry.c
blob: d3ab78c0de428a5e37d3d225d5a06c270fd201b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- common/seahorse-registry.c.orig 2009-02-14 19:20:38.000000000 +0100
+++ common/seahorse-registry.c  2009-02-24 21:15:26.000000000 +0100
@@ -51,6 +51,25 @@
    registry_singleton = NULL;
 }
 
+static guint registry_hash (gconstpointer key)
+{
+   SeahorseRegistryType *rtype;
+
+   rtype = (SeahorseRegistryType *) key;
+
+   return (guint) rtype->type;
+}
+
+static gboolean registry_equal (gconstpointer a, gconstpointer b)
+{
+   SeahorseRegistryType *rta, *rtb;
+
+   rta = (SeahorseRegistryType *) a;
+   rtb = (SeahorseRegistryType *) b;
+
+   return (rta->type == rtb->type);
+}
+
 static void
 keys_to_list (gpointer key, gpointer value, gpointer user_data)
 {
@@ -63,13 +82,14 @@
                              gpointer value, GDestroyNotify destroy_func)
 {
    GHashTable *set;
+   SeahorseRegistryType *rtype;
    
    g_return_if_fail (table);
    g_return_if_fail (category);
    
    set = g_hash_table_lookup (table, GUINT_TO_POINTER (category));
    if (!set) {
-       set = g_hash_table_new_full (g_direct_hash, g_direct_equal, destroy_func, NULL);
+       set = g_hash_table_new_full (registry_hash, registry_equal, destroy_func, NULL);
        g_hash_table_replace (table, GUINT_TO_POINTER (category), set);
    }