diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-01-24 21:35:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-01-24 21:35:50 +0000 |
commit | b8d9f64cdf009b7bde0b43309eee076fb952a6df (patch) | |
tree | 86f2dfb56ade836973a3edae9c578b00c0ba0328 /src/util/container_multihashmap.c | |
parent | 24c5eeebdc45cba6e0f5447733d38e3332939fe8 (diff) | |
download | gnunet-b8d9f64cdf009b7bde0b43309eee076fb952a6df.tar.gz gnunet-b8d9f64cdf009b7bde0b43309eee076fb952a6df.zip |
api
Diffstat (limited to 'src/util/container_multihashmap.c')
-rw-r--r-- | src/util/container_multihashmap.c | 30 |
1 files changed, 30 insertions, 0 deletions
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 | |||
@@ -336,6 +336,36 @@ GNUNET_CONTAINER_multihashmap_contains (const struct | |||
336 | 336 | ||
337 | 337 | ||
338 | /** | 338 | /** |
339 | * Check if the map contains the given value under the given | ||
340 | * key. | ||
341 | * | ||
342 | * @param map the map | ||
343 | * @param key the key to test if a value exists for it | ||
344 | * @param value value to test for | ||
345 | * @return GNUNET_YES if such a value exists, | ||
346 | * GNUNET_NO if not | ||
347 | */ | ||
348 | int GNUNET_CONTAINER_multihashmap_contains_value (const struct | ||
349 | GNUNET_CONTAINER_MultiHashMap | ||
350 | *map, | ||
351 | const GNUNET_HashCode * key, | ||
352 | const void *value) | ||
353 | { | ||
354 | struct MapEntry *e; | ||
355 | |||
356 | e = map->map[idx_of (map, key)]; | ||
357 | while (e != NULL) | ||
358 | { | ||
359 | if ( (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) && | ||
360 | (e->value == value) ) | ||
361 | return GNUNET_YES; | ||
362 | e = e->next; | ||
363 | } | ||
364 | return GNUNET_NO; | ||
365 | } | ||
366 | |||
367 | |||
368 | /** | ||
339 | * Grow the given map to a more appropriate size. | 369 | * Grow the given map to a more appropriate size. |
340 | * | 370 | * |
341 | * @param map the hash map to grow | 371 | * @param map the hash map to grow |