aboutsummaryrefslogtreecommitdiff
path: root/src/util/container_multihashmap.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-31 12:26:35 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-31 12:26:35 +0000
commitfff52507192299e66581692e832d7e4ecd58bf22 (patch)
tree1439a0d57b6a3b2513d56b1f4d1b0e36c31e93a8 /src/util/container_multihashmap.c
parent693ed6b98d115da771975506c1433df6885c6232 (diff)
downloadgnunet-fff52507192299e66581692e832d7e4ecd58bf22.tar.gz
gnunet-fff52507192299e66581692e832d7e4ecd58bf22.zip
-doxygen
Diffstat (limited to 'src/util/container_multihashmap.c')
-rw-r--r--src/util/container_multihashmap.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c
index d62f5f366..567ee1251 100644
--- a/src/util/container_multihashmap.c
+++ b/src/util/container_multihashmap.c
@@ -114,8 +114,8 @@ struct GNUNET_CONTAINER_MultiHashMap
114 unsigned int map_length; 114 unsigned int map_length;
115 115
116 /** 116 /**
117 * GNUNET_NO if the map entries are of type 'struct BigMapEntry', 117 * #GNUNET_NO if the map entries are of type 'struct BigMapEntry',
118 * GNUNET_YES if the map entries are of type 'struct SmallMapEntry'. 118 * #GNUNET_YES if the map entries are of type 'struct SmallMapEntry'.
119 */ 119 */
120 int use_small_entries; 120 int use_small_entries;
121 121
@@ -160,8 +160,8 @@ struct GNUNET_CONTAINER_MultiHashMapIterator
160 * Create a multi hash map. 160 * Create a multi hash map.
161 * 161 *
162 * @param len initial size (map will grow as needed) 162 * @param len initial size (map will grow as needed)
163 * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; 163 * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default;
164 * GNUNET_YES means that on 'put', the 'key' does not have 164 * #GNUNET_YES means that on 'put', the 'key' does not have
165 * to be copied as the destination of the pointer is 165 * to be copied as the destination of the pointer is
166 * guaranteed to be life as long as the value is stored in 166 * guaranteed to be life as long as the value is stored in
167 * the hashmap. This can significantly reduce memory 167 * the hashmap. This can significantly reduce memory
@@ -306,9 +306,9 @@ GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap
306 * 306 *
307 * @param map the map 307 * @param map the map
308 * @param it function to call on each entry 308 * @param it function to call on each entry
309 * @param it_cls extra argument to it 309 * @param it_cls extra argument to @a it
310 * @return the number of key value pairs processed, 310 * @return the number of key value pairs processed,
311 * GNUNET_SYSERR if it aborted iteration 311 * #GNUNET_SYSERR if it aborted iteration
312 */ 312 */
313int 313int
314GNUNET_CONTAINER_multihashmap_iterate (const struct 314GNUNET_CONTAINER_multihashmap_iterate (const struct
@@ -374,7 +374,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct
374 * @param map the map 374 * @param map the map
375 * @param key key of the key-value pair 375 * @param key key of the key-value pair
376 * @param value value of the key-value pair 376 * @param value value of the key-value pair
377 * @return GNUNET_YES on success, GNUNET_NO if the key-value pair 377 * @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
378 * is not in the map 378 * is not in the map
379 */ 379 */
380int 380int
@@ -479,7 +479,7 @@ GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
479 sme = map->map[i].sme; 479 sme = map->map[i].sme;
480 else 480 else
481 sme = p->next; 481 sme = p->next;
482 ret++; 482 ret++;
483 } 483 }
484 else 484 else
485 { 485 {
@@ -528,8 +528,8 @@ GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
528 * 528 *
529 * @param map the map 529 * @param map the map
530 * @param key the key to test if a value exists for it 530 * @param key the key to test if a value exists for it
531 * @return GNUNET_YES if such a value exists, 531 * @return #GNUNET_YES if such a value exists,
532 * GNUNET_NO if not 532 * #GNUNET_NO if not
533 */ 533 */
534int 534int
535GNUNET_CONTAINER_multihashmap_contains (const struct 535GNUNET_CONTAINER_multihashmap_contains (const struct
@@ -566,8 +566,8 @@ GNUNET_CONTAINER_multihashmap_contains (const struct
566 * @param map the map 566 * @param map the map
567 * @param key the key to test if a value exists for it 567 * @param key the key to test if a value exists for it
568 * @param value value to test for 568 * @param value value to test for
569 * @return GNUNET_YES if such a value exists, 569 * @return #GNUNET_YES if such a value exists,
570 * GNUNET_NO if not 570 * #GNUNET_NO if not
571 */ 571 */
572int 572int
573GNUNET_CONTAINER_multihashmap_contains_value (const struct 573GNUNET_CONTAINER_multihashmap_contains_value (const struct
@@ -642,7 +642,7 @@ grow (struct GNUNET_CONTAINER_MultiHashMap *map)
642 struct BigMapEntry *bme; 642 struct BigMapEntry *bme;
643 643
644 while (NULL != (bme = old_map[i].bme)) 644 while (NULL != (bme = old_map[i].bme))
645 { 645 {
646 old_map[i].bme = bme->next; 646 old_map[i].bme = bme->next;
647 idx = idx_of (map, &bme->key); 647 idx = idx_of (map, &bme->key);
648 bme->next = new_map[idx].bme; 648 bme->next = new_map[idx].bme;
@@ -661,9 +661,9 @@ grow (struct GNUNET_CONTAINER_MultiHashMap *map)
661 * @param key key to use 661 * @param key key to use
662 * @param value value to use 662 * @param value value to use
663 * @param opt options for put 663 * @param opt options for put
664 * @return GNUNET_OK on success, 664 * @return #GNUNET_OK on success,
665 * GNUNET_NO if a value was replaced (with REPLACE) 665 * #GNUNET_NO if a value was replaced (with REPLACE)
666 * GNUNET_SYSERR if UNIQUE_ONLY was the option and the 666 * #GNUNET_SYSERR if UNIQUE_ONLY was the option and the
667 * value already exists 667 * value already exists
668 */ 668 */
669int 669int
@@ -745,7 +745,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
745 * @param it function to call on each entry 745 * @param it function to call on each entry
746 * @param it_cls extra argument to it 746 * @param it_cls extra argument to it
747 * @return the number of key value pairs processed, 747 * @return the number of key value pairs processed,
748 * GNUNET_SYSERR if it aborted iteration 748 * #GNUNET_SYSERR if it aborted iteration
749 */ 749 */
750int 750int
751GNUNET_CONTAINER_multihashmap_get_multiple (const struct 751GNUNET_CONTAINER_multihashmap_get_multiple (const struct
@@ -799,7 +799,7 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct
799 * Create an iterator for a multihashmap. 799 * Create an iterator for a multihashmap.
800 * The iterator can be used to retrieve all the elements in the multihashmap 800 * The iterator can be used to retrieve all the elements in the multihashmap
801 * one by one, without having to handle all elements at once (in contrast to 801 * one by one, without having to handle all elements at once (in contrast to
802 * 'GNUNET_CONTAINER_multihashmap_iterate'). Note that the iterator can not be 802 * GNUNET_CONTAINER_multihashmap_iterate()). Note that the iterator can not be
803 * used anymore if elements have been removed from 'map' after the creation of 803 * used anymore if elements have been removed from 'map' after the creation of
804 * the iterator, or 'map' has been destroyed. Adding elements to 'map' may 804 * the iterator, or 'map' has been destroyed. Adding elements to 'map' may
805 * result in skipped or repeated elements. 805 * result in skipped or repeated elements.
@@ -831,12 +831,13 @@ GNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_Mul
831 * @param iter the iterator to get the next element from 831 * @param iter the iterator to get the next element from
832 * @param key pointer to store the key in, can be NULL 832 * @param key pointer to store the key in, can be NULL
833 * @param value pointer to store the value in, can be NULL 833 * @param value pointer to store the value in, can be NULL
834 * @return GNUNET_YES we returned an element, 834 * @return #GNUNET_YES we returned an element,
835 * GNUNET_NO if we are out of elements 835 * #GNUNET_NO if we are out of elements
836 */ 836 */
837int 837int
838GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter, 838GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter,
839 struct GNUNET_HashCode *key, const void **value) 839 struct GNUNET_HashCode *key,
840 const void **value)
840{ 841{
841 /* make sure the map has not been modified */ 842 /* make sure the map has not been modified */
842 GNUNET_assert (iter->modification_counter == iter->map->modification_counter); 843 GNUNET_assert (iter->modification_counter == iter->map->modification_counter);