PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Thu Nov 8 09:27:31 PST 2007


 polkit/polkit-hash.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 85231a09edd0627e42f1e787638bf2c892dce066
Author: David Zeuthen <davidz at redhat.com>
Date:   Thu Nov 8 12:24:17 2007 -0500

    reimplement string hashing and comparison

diff --git a/polkit/polkit-hash.c b/polkit/polkit-hash.c
index 2558a3f..ef2797d 100644
--- a/polkit/polkit-hash.c
+++ b/polkit/polkit-hash.c
@@ -406,8 +406,14 @@ polkit_hash_direct_equal_func (const void *v1, const void *v2)
 polkit_uint32_t
 polkit_hash_str_hash_func (const void *key)
 {
-        /* TODO: reimplement */
-        return g_str_hash (key);
+        const char *p;
+        polkit_uint32_t hash;
+
+        hash = 0;
+        for (p = key; *p != '\0'; p++)
+                hash = hash * 617 ^ *p;
+
+        return hash;
 }
 
 /**
@@ -424,8 +430,7 @@ polkit_hash_str_hash_func (const void *key)
 polkit_bool_t
 polkit_hash_str_equal_func (const void *v1, const void *v2)
 {
-        /* TODO: reimplement */
-        return g_str_equal (v1, v2);
+        return strcmp (v1, v2) == 0;
 }
 
 /**


More information about the hal-commit mailing list