gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10843 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r10843 - gnunet/src/util
Date: Thu, 8 Apr 2010 14:49:21 +0200

Author: grothoff
Date: 2010-04-08 14:49:21 +0200 (Thu, 08 Apr 2010)
New Revision: 10843

Modified:
   gnunet/src/util/container_multihashmap.c
Log:
make sure key stays valid for iterator even after entry is removed

Modified: gnunet/src/util/container_multihashmap.c
===================================================================
--- gnunet/src/util/container_multihashmap.c    2010-04-07 15:45:11 UTC (rev 
10842)
+++ gnunet/src/util/container_multihashmap.c    2010-04-08 12:49:21 UTC (rev 
10843)
@@ -194,6 +194,7 @@
   unsigned int i;
   struct MapEntry *e;
   struct MapEntry *n;
+  GNUNET_HashCode kc;
 
   count = 0;
   for (i = 0; i < map->map_length; i++)
@@ -202,8 +203,12 @@
       while (NULL != (e = n))
         {
          n = e->next;
-          if ((NULL != it) && (GNUNET_OK != it (it_cls, &e->key, e->value)))
-            return GNUNET_SYSERR;
+          if (NULL != it)
+           {
+             kc = e->key;
+             if (GNUNET_OK != it (it_cls, &kc, e->value))
+               return GNUNET_SYSERR;
+           }
           count++;
         }
     }
@@ -446,7 +451,7 @@
       n = e->next;
       if (0 != memcmp (key, &e->key, sizeof (GNUNET_HashCode)))
        continue;
-      if ((it != NULL) && (GNUNET_OK != it (it_cls, &e->key, e->value)))
+      if ((it != NULL) && (GNUNET_OK != it (it_cls, key, e->value)))
        return GNUNET_SYSERR;
       count++;
     }





reply via email to

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