From: Christian Grothoff Date: Fri, 29 Jan 2010 12:21:03 +0000 (+0000) Subject: support removing of current entry by callback X-Git-Tag: initial-import-from-subversion-38251~22834 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1d331d111abd6285148321262a50ca7784eaaf97;p=oweals%2Fgnunet.git support removing of current entry by callback --- diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c index e291b8b50..773b24928 100644 --- a/src/util/container_multihashmap.c +++ b/src/util/container_multihashmap.c @@ -435,18 +435,18 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct { int count; struct MapEntry *e; + struct MapEntry *n; count = 0; - e = map->map[idx_of (map, key)]; - while (e != NULL) + n = map->map[idx_of (map, key)]; + while (NULL != (e = n)) { - if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) - { - if ((it != NULL) && (GNUNET_OK != it (it_cls, &e->key, e->value))) - return GNUNET_SYSERR; - count++; - } - e = e->next; + 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))) + return GNUNET_SYSERR; + count++; } return count; }