From: Christian Grothoff Date: Mon, 24 Jan 2011 21:35:50 +0000 (+0000) Subject: api X-Git-Tag: initial-import-from-subversion-38251~19259 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b8d9f64cdf009b7bde0b43309eee076fb952a6df;p=oweals%2Fgnunet.git api --- diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c index b5f663e67..579573bdb 100644 --- a/src/util/container_multihashmap.c +++ b/src/util/container_multihashmap.c @@ -335,6 +335,36 @@ GNUNET_CONTAINER_multihashmap_contains (const struct } +/** + * Check if the map contains the given value under the given + * key. + * + * @param map the map + * @param key the key to test if a value exists for it + * @param value value to test for + * @return GNUNET_YES if such a value exists, + * GNUNET_NO if not + */ +int GNUNET_CONTAINER_multihashmap_contains_value (const struct + GNUNET_CONTAINER_MultiHashMap + *map, + const GNUNET_HashCode * key, + const void *value) +{ + struct MapEntry *e; + + e = map->map[idx_of (map, key)]; + while (e != NULL) + { + if ( (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) && + (e->value == value) ) + return GNUNET_YES; + e = e->next; + } + return GNUNET_NO; +} + + /** * Grow the given map to a more appropriate size. *