gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5399 - GNUnet/src/util/containers


From: gnunet
Subject: [GNUnet-SVN] r5399 - GNUnet/src/util/containers
Date: Tue, 31 Jul 2007 09:45:06 -0600 (MDT)

Author: durner
Date: 2007-07-31 09:44:59 -0600 (Tue, 31 Jul 2007)
New Revision: 5399

Modified:
   GNUnet/src/util/containers/hashtable.c
   GNUnet/src/util/containers/hashtabletest.c
Log:
fix handling of hash collisions

Modified: GNUnet/src/util/containers/hashtable.c
===================================================================
--- GNUnet/src/util/containers/hashtable.c      2007-07-31 04:52:23 UTC (rev 
5398)
+++ GNUnet/src/util/containers/hashtable.c      2007-07-31 15:44:59 UTC (rev 
5399)
@@ -242,9 +242,13 @@
   hashValue = weakHash (key, keylen) % hashTable->numOfBuckets;
   pair = hashTable->bucketArray[hashValue];
 
-  while (pair != NULL && pair->keylen != keylen &&
-         memcmp (key, pair->key, keylen) != 0)
-    pair = pair->next;
+  while(pair)
+    {
+      if (pair->keylen == keylen)
+        if (memcmp(key, pair->key, key) == 0)
+          break;
+      pair = pair->next;
+    }
 
   if (pair)
     {

Modified: GNUnet/src/util/containers/hashtabletest.c
===================================================================
--- GNUnet/src/util/containers/hashtabletest.c  2007-07-31 04:52:23 UTC (rev 
5398)
+++ GNUnet/src/util/containers/hashtabletest.c  2007-07-31 15:44:59 UTC (rev 
5399)
@@ -30,7 +30,7 @@
 static int
 testHT ()
 {
-  struct HashTable *ht = ht_create (10);
+  struct HashTable *ht = ht_create (3);
   void *val;
   unsigned int vallen;
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]