From 1d331d111abd6285148321262a50ca7784eaaf97 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 29 Jan 2010 12:21:03 +0000 Subject: support removing of current entry by callback --- src/util/container_multihashmap.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3