aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorWillow Liquorice <willow@howhill.com>2022-08-27 20:07:26 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-08-30 09:42:09 +0200
commit8c6a68c258061f68466905393b76106436d3dccf (patch)
tree7ecd4b101fd76859c630a93e54ce6e8e7aecbbb1 /src/util
parent08a0ef9dff9d401bfaae332a076716c49f85d7ca (diff)
downloadgnunet-8c6a68c258061f68466905393b76106436d3dccf.tar.gz
gnunet-8c6a68c258061f68466905393b76106436d3dccf.zip
-DOC first pass through UTIL container library
Diffstat (limited to 'src/util')
-rw-r--r--src/util/container_bloomfilter.c11
-rw-r--r--src/util/container_heap.c62
-rw-r--r--src/util/container_meta_data.c70
-rw-r--r--src/util/container_multihashmap.c125
-rw-r--r--src/util/container_multihashmap32.c73
-rw-r--r--src/util/container_multipeermap.c137
-rw-r--r--src/util/container_multishortmap.c112
-rw-r--r--src/util/container_multiuuidmap.c112
8 files changed, 0 insertions, 702 deletions
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c
index 9f6c3c0cc..4bfb82d14 100644
--- a/src/util/container_bloomfilter.c
+++ b/src/util/container_bloomfilter.c
@@ -467,17 +467,6 @@ testBitCallback (void *cls,
467 467
468/* *********************** INTERFACE **************** */ 468/* *********************** INTERFACE **************** */
469 469
470/**
471 * Load a bloom-filter from a file.
472 *
473 * @param filename the name of the file (or the prefix)
474 * @param size the size of the bloom-filter (number of
475 * bytes of storage space to use); will be rounded up
476 * to next power of 2
477 * @param k the number of GNUNET_CRYPTO_hash-functions to apply per
478 * element (number of bits set per element in the set)
479 * @return the bloomfilter
480 */
481struct GNUNET_CONTAINER_BloomFilter * 470struct GNUNET_CONTAINER_BloomFilter *
482GNUNET_CONTAINER_bloomfilter_load (const char *filename, 471GNUNET_CONTAINER_bloomfilter_load (const char *filename,
483 size_t size, 472 size_t size,
diff --git a/src/util/container_heap.c b/src/util/container_heap.c
index 35d7cd4ab..24f753adb 100644
--- a/src/util/container_heap.c
+++ b/src/util/container_heap.c
@@ -129,12 +129,6 @@ check (const struct GNUNET_CONTAINER_HeapNode *node)
129#endif 129#endif
130 130
131 131
132/**
133 * Create a new heap.
134 *
135 * @param order how should the heap be sorted?
136 * @return handle to the heap
137 */
138struct GNUNET_CONTAINER_Heap * 132struct GNUNET_CONTAINER_Heap *
139GNUNET_CONTAINER_heap_create (enum GNUNET_CONTAINER_HeapOrder order) 133GNUNET_CONTAINER_heap_create (enum GNUNET_CONTAINER_HeapOrder order)
140{ 134{
@@ -146,12 +140,6 @@ GNUNET_CONTAINER_heap_create (enum GNUNET_CONTAINER_HeapOrder order)
146} 140}
147 141
148 142
149/**
150 * Destroys the heap. Only call on a heap that
151 * is already empty.
152 *
153 * @param heap heap to destroy
154 */
155void 143void
156GNUNET_CONTAINER_heap_destroy (struct GNUNET_CONTAINER_Heap *heap) 144GNUNET_CONTAINER_heap_destroy (struct GNUNET_CONTAINER_Heap *heap)
157{ 145{
@@ -160,12 +148,6 @@ GNUNET_CONTAINER_heap_destroy (struct GNUNET_CONTAINER_Heap *heap)
160} 148}
161 149
162 150
163/**
164 * Get element stored at the root of @a heap.
165 *
166 * @param heap Heap to inspect.
167 * @return Element at the root, or NULL if heap is empty.
168 */
169void * 151void *
170GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap) 152GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap)
171{ 153{
@@ -199,12 +181,6 @@ GNUNET_CONTAINER_heap_peek2 (const struct GNUNET_CONTAINER_Heap *heap,
199} 181}
200 182
201 183
202/**
203 * Get the current size of the heap
204 *
205 * @param heap the heap to get the size of
206 * @return number of elements stored
207 */
208unsigned int 184unsigned int
209GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap *heap) 185GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap *heap)
210{ 186{
@@ -212,12 +188,6 @@ GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap *heap)
212} 188}
213 189
214 190
215/**
216 * Get the current cost of the node
217 *
218 * @param node the node to get the cost of
219 * @return cost of the node
220 */
221GNUNET_CONTAINER_HeapCostType 191GNUNET_CONTAINER_HeapCostType
222GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode 192GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode
223 *node) 193 *node)
@@ -252,13 +222,6 @@ node_iterator (const struct GNUNET_CONTAINER_Heap *heap,
252} 222}
253 223
254 224
255/**
256 * Iterate over all entries in the heap.
257 *
258 * @param heap the heap
259 * @param iterator function to call on each entry
260 * @param iterator_cls closure for iterator
261 */
262void 225void
263GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap, 226GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap,
264 GNUNET_CONTAINER_HeapIterator iterator, 227 GNUNET_CONTAINER_HeapIterator iterator,
@@ -268,17 +231,6 @@ GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap,
268} 231}
269 232
270 233
271/**
272 * Perform a random walk of the tree. The walk is biased
273 * towards elements closer to the root of the tree (since
274 * each walk starts at the root and ends at a random leaf).
275 * The heap internally tracks the current position of the
276 * walk.
277 *
278 * @param heap heap to walk
279 * @return data stored at the next random node in the walk;
280 * NULL if the tree is empty.
281 */
282void * 234void *
283GNUNET_CONTAINER_heap_walk_get_next (struct GNUNET_CONTAINER_Heap *heap) 235GNUNET_CONTAINER_heap_walk_get_next (struct GNUNET_CONTAINER_Heap *heap)
284{ 236{
@@ -360,14 +312,6 @@ insert_node (struct GNUNET_CONTAINER_Heap *heap,
360} 312}
361 313
362 314
363/**
364 * Inserts a new element into the heap.
365 *
366 * @param heap heap to modify
367 * @param element element to insert
368 * @param cost cost for the element
369 * @return node for the new element
370 */
371struct GNUNET_CONTAINER_HeapNode * 315struct GNUNET_CONTAINER_HeapNode *
372GNUNET_CONTAINER_heap_insert (struct GNUNET_CONTAINER_Heap *heap, void *element, 316GNUNET_CONTAINER_heap_insert (struct GNUNET_CONTAINER_Heap *heap, void *element,
373 GNUNET_CONTAINER_HeapCostType cost) 317 GNUNET_CONTAINER_HeapCostType cost)
@@ -536,12 +480,6 @@ GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode *node)
536} 480}
537 481
538 482
539/**
540 * Updates the cost of any node in the tree
541 *
542 * @param node node for which the cost is to be changed
543 * @param new_cost new cost for the node
544 */
545void 483void
546GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_HeapNode *node, 484GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_HeapNode *node,
547 GNUNET_CONTAINER_HeapCostType new_cost) 485 GNUNET_CONTAINER_HeapCostType new_cost)
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c
index 2c477db40..52882c5f3 100644
--- a/src/util/container_meta_data.c
+++ b/src/util/container_meta_data.c
@@ -241,11 +241,6 @@ invalidate_sbuf (struct GNUNET_CONTAINER_MetaData *md)
241} 241}
242 242
243 243
244/**
245 * Free meta data.
246 *
247 * @param md what to free
248 */
249void 244void
250GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md) 245GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md)
251{ 246{
@@ -263,11 +258,6 @@ GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md)
263} 258}
264 259
265 260
266/**
267 * Remove all items in the container.
268 *
269 * @param md metadata to manipulate
270 */
271void 261void
272GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md) 262GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md)
273{ 263{
@@ -285,16 +275,6 @@ GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md)
285} 275}
286 276
287 277
288/**
289 * Test if two MDs are equal. We consider them equal if
290 * the meta types, formats and content match (we do not
291 * include the mime types and plugins names in this
292 * consideration).
293 *
294 * @param md1 first value to check
295 * @param md2 other value to check
296 * @return #GNUNET_YES if they are equal
297 */
298int 278int
299GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData 279GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData
300 *md1, 280 *md1,
@@ -451,13 +431,6 @@ merge_helper (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
451} 431}
452 432
453 433
454/**
455 * Extend metadata. Merges the meta data from the second argument
456 * into the first, discarding duplicate key-value pairs.
457 *
458 * @param md metadata to extend
459 * @param in metadata to merge
460 */
461void 434void
462GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, 435GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
463 const struct GNUNET_CONTAINER_MetaData *in) 436 const struct GNUNET_CONTAINER_MetaData *in)
@@ -466,16 +439,6 @@ GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
466} 439}
467 440
468 441
469/**
470 * Remove an item.
471 *
472 * @param md metadata to manipulate
473 * @param type type of the item to remove
474 * @param data specific value to remove, NULL to remove all
475 * entries of the given type
476 * @param data_size number of bytes in @a data
477 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the item does not exist in md
478 */
479int 442int
480GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, 443GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
481 enum EXTRACTOR_MetaType type, 444 enum EXTRACTOR_MetaType type,
@@ -503,12 +466,6 @@ GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
503} 466}
504 467
505 468
506/**
507 * Add the current time as the publication date
508 * to the meta-data.
509 *
510 * @param md metadata to modify
511 */
512void 469void
513GNUNET_CONTAINER_meta_data_add_publication_date (struct 470GNUNET_CONTAINER_meta_data_add_publication_date (struct
514 GNUNET_CONTAINER_MetaData *md) 471 GNUNET_CONTAINER_MetaData *md)
@@ -556,16 +513,6 @@ GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData *md,
556} 513}
557 514
558 515
559/**
560 * Get the first MD entry of the given type. Caller
561 * is responsible for freeing the return value.
562 * Also, only meta data items that are strings (0-terminated)
563 * are returned by this function.
564 *
565 * @param md metadata to inspect
566 * @param type type to look for
567 * @return NULL if no entry was found
568 */
569char * 516char *
570GNUNET_CONTAINER_meta_data_get_by_type (const struct 517GNUNET_CONTAINER_meta_data_get_by_type (const struct
571 GNUNET_CONTAINER_MetaData *md, 518 GNUNET_CONTAINER_MetaData *md,
@@ -584,17 +531,6 @@ GNUNET_CONTAINER_meta_data_get_by_type (const struct
584} 531}
585 532
586 533
587/**
588 * Get the first matching MD entry of the given types. Caller is
589 * responsible for freeing the return value. Also, only meta data
590 * items that are strings (0-terminated) are returned by this
591 * function.
592 *
593 * @param md metadata to inspect
594 * @param ... -1-terminated list of types
595 * @return NULL if we do not have any such entry,
596 * otherwise client is responsible for freeing the value!
597 */
598char * 534char *
599GNUNET_CONTAINER_meta_data_get_first_by_types (const struct 535GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
600 GNUNET_CONTAINER_MetaData *md, 536 GNUNET_CONTAINER_MetaData *md,
@@ -997,12 +933,6 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
997} 933}
998 934
999 935
1000/**
1001 * Get the size of the full meta-data in serialized form.
1002 *
1003 * @param md metadata to inspect
1004 * @return number of bytes needed for serialization, -1 on error
1005 */
1006ssize_t 936ssize_t
1007GNUNET_CONTAINER_meta_data_get_serialized_size (const struct 937GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
1008 GNUNET_CONTAINER_MetaData *md) 938 GNUNET_CONTAINER_MetaData *md)
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c
index 08893d81f..8b1deac12 100644
--- a/src/util/container_multihashmap.c
+++ b/src/util/container_multihashmap.c
@@ -175,21 +175,6 @@ struct GNUNET_CONTAINER_MultiHashMapIterator
175}; 175};
176 176
177 177
178/**
179 * Create a multi hash map.
180 *
181 * @param len initial size (map will grow as needed)
182 * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default;
183 * #GNUNET_YES means that on 'put', the 'key' does not have
184 * to be copied as the destination of the pointer is
185 * guaranteed to be life as long as the value is stored in
186 * the hashmap. This can significantly reduce memory
187 * consumption, but of course is also a recipe for
188 * heap corruption if the assumption is not true. Only
189 * use this if (1) memory use is important in this case and
190 * (2) you have triple-checked that the invariant holds
191 * @return NULL on error
192 */
193struct GNUNET_CONTAINER_MultiHashMap * 178struct GNUNET_CONTAINER_MultiHashMap *
194GNUNET_CONTAINER_multihashmap_create (unsigned int len, int do_not_copy_keys) 179GNUNET_CONTAINER_multihashmap_create (unsigned int len, int do_not_copy_keys)
195{ 180{
@@ -225,12 +210,6 @@ GNUNET_CONTAINER_multihashmap_create (unsigned int len, int do_not_copy_keys)
225} 210}
226 211
227 212
228/**
229 * Destroy a hash map. Will not free any values stored in the hash
230 * map!
231 *
232 * @param map the map
233 */
234void 213void
235GNUNET_CONTAINER_multihashmap_destroy ( 214GNUNET_CONTAINER_multihashmap_destroy (
236 struct GNUNET_CONTAINER_MultiHashMap *map) 215 struct GNUNET_CONTAINER_MultiHashMap *map)
@@ -289,12 +268,6 @@ idx_of (const struct GNUNET_CONTAINER_MultiHashMap *map,
289} 268}
290 269
291 270
292/**
293 * Get the number of key-value pairs in the map.
294 *
295 * @param map the map
296 * @return the number of key value pairs
297 */
298unsigned int 271unsigned int
299GNUNET_CONTAINER_multihashmap_size ( 272GNUNET_CONTAINER_multihashmap_size (
300 const struct GNUNET_CONTAINER_MultiHashMap *map) 273 const struct GNUNET_CONTAINER_MultiHashMap *map)
@@ -303,16 +276,6 @@ GNUNET_CONTAINER_multihashmap_size (
303} 276}
304 277
305 278
306/**
307 * Given a key find a value in the map matching the key.
308 *
309 * @param map the map
310 * @param key what to look for
311 * @return NULL if no value was found; note that
312 * this is indistinguishable from values that just
313 * happen to be NULL; use "contains" to test for
314 * key-value pairs with value NULL
315 */
316void * 279void *
317GNUNET_CONTAINER_multihashmap_get ( 280GNUNET_CONTAINER_multihashmap_get (
318 const struct GNUNET_CONTAINER_MultiHashMap *map, 281 const struct GNUNET_CONTAINER_MultiHashMap *map,
@@ -341,15 +304,6 @@ GNUNET_CONTAINER_multihashmap_get (
341} 304}
342 305
343 306
344/**
345 * Iterate over all entries in the map.
346 *
347 * @param map the map
348 * @param it function to call on each entry
349 * @param it_cls extra argument to @a it
350 * @return the number of key value pairs processed,
351 * #GNUNET_SYSERR if it aborted iteration
352 */
353int 307int
354GNUNET_CONTAINER_multihashmap_iterate ( 308GNUNET_CONTAINER_multihashmap_iterate (
355 struct GNUNET_CONTAINER_MultiHashMap *map, 309 struct GNUNET_CONTAINER_MultiHashMap *map,
@@ -447,17 +401,6 @@ update_next_cache_sme (struct GNUNET_CONTAINER_MultiHashMap *map,
447} 401}
448 402
449 403
450/**
451 * Remove the given key-value pair from the map. Note that if the
452 * key-value pair is in the map multiple times, only one of the pairs
453 * will be removed.
454 *
455 * @param map the map
456 * @param key key of the key-value pair
457 * @param value value of the key-value pair
458 * @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
459 * is not in the map
460 */
461int 404int
462GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, 405GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
463 const struct GNUNET_HashCode *key, 406 const struct GNUNET_HashCode *key,
@@ -516,14 +459,6 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
516} 459}
517 460
518 461
519/**
520 * Remove all entries for the given key from the map.
521 * Note that the values would not be "freed".
522 *
523 * @param map the map
524 * @param key identifies values to be removed
525 * @return number of values removed
526 */
527int 462int
528GNUNET_CONTAINER_multihashmap_remove_all ( 463GNUNET_CONTAINER_multihashmap_remove_all (
529 struct GNUNET_CONTAINER_MultiHashMap *map, 464 struct GNUNET_CONTAINER_MultiHashMap *map,
@@ -642,15 +577,6 @@ GNUNET_CONTAINER_multihashmap_clear (struct GNUNET_CONTAINER_MultiHashMap *map)
642} 577}
643 578
644 579
645/**
646 * Check if the map contains any value under the given
647 * key (including values that are NULL).
648 *
649 * @param map the map
650 * @param key the key to test if a value exists for it
651 * @return #GNUNET_YES if such a value exists,
652 * #GNUNET_NO if not
653 */
654int 580int
655GNUNET_CONTAINER_multihashmap_contains ( 581GNUNET_CONTAINER_multihashmap_contains (
656 const struct GNUNET_CONTAINER_MultiHashMap *map, 582 const struct GNUNET_CONTAINER_MultiHashMap *map,
@@ -679,16 +605,6 @@ GNUNET_CONTAINER_multihashmap_contains (
679} 605}
680 606
681 607
682/**
683 * Check if the map contains the given value under the given
684 * key.
685 *
686 * @param map the map
687 * @param key the key to test if a value exists for it
688 * @param value value to test for
689 * @return #GNUNET_YES if such a value exists,
690 * #GNUNET_NO if not
691 */
692int 608int
693GNUNET_CONTAINER_multihashmap_contains_value ( 609GNUNET_CONTAINER_multihashmap_contains_value (
694 const struct GNUNET_CONTAINER_MultiHashMap *map, 610 const struct GNUNET_CONTAINER_MultiHashMap *map,
@@ -860,16 +776,6 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
860} 776}
861 777
862 778
863/**
864 * Iterate over all entries in the map that match a particular key.
865 *
866 * @param map the map
867 * @param key key that the entries must correspond to
868 * @param it function to call on each entry
869 * @param it_cls extra argument to it
870 * @return the number of key value pairs processed,
871 * #GNUNET_SYSERR if it aborted iteration
872 */
873int 779int
874GNUNET_CONTAINER_multihashmap_get_multiple ( 780GNUNET_CONTAINER_multihashmap_get_multiple (
875 struct GNUNET_CONTAINER_MultiHashMap *map, 781 struct GNUNET_CONTAINER_MultiHashMap *map,
@@ -997,18 +903,6 @@ GNUNET_CONTAINER_multihashmap_get_random (
997} 903}
998 904
999 905
1000/**
1001 * Create an iterator for a multihashmap.
1002 * The iterator can be used to retrieve all the elements in the multihashmap
1003 * one by one, without having to handle all elements at once (in contrast to
1004 * GNUNET_CONTAINER_multihashmap_iterate()). Note that the iterator can not be
1005 * used anymore if elements have been removed from 'map' after the creation of
1006 * the iterator, or 'map' has been destroyed. Adding elements to 'map' may
1007 * result in skipped or repeated elements.
1008 *
1009 * @param map the map to create an iterator for
1010 * @return an iterator over the given multihashmap 'map'
1011 */
1012struct GNUNET_CONTAINER_MultiHashMapIterator * 906struct GNUNET_CONTAINER_MultiHashMapIterator *
1013GNUNET_CONTAINER_multihashmap_iterator_create ( 907GNUNET_CONTAINER_multihashmap_iterator_create (
1014 const struct GNUNET_CONTAINER_MultiHashMap *map) 908 const struct GNUNET_CONTAINER_MultiHashMap *map)
@@ -1023,20 +917,6 @@ GNUNET_CONTAINER_multihashmap_iterator_create (
1023} 917}
1024 918
1025 919
1026/**
1027 * Retrieve the next element from the hash map at the iterator's position.
1028 * If there are no elements left, GNUNET_NO is returned, and 'key' and 'value'
1029 * are not modified.
1030 * This operation is only allowed if no elements have been removed from the
1031 * multihashmap since the creation of 'iter', and the map has not been destroyed.
1032 * Adding elements may result in repeating or skipping elements.
1033 *
1034 * @param iter the iterator to get the next element from
1035 * @param key pointer to store the key in, can be NULL
1036 * @param value pointer to store the value in, can be NULL
1037 * @return #GNUNET_YES we returned an element,
1038 * #GNUNET_NO if we are out of elements
1039 */
1040int 920int
1041GNUNET_CONTAINER_multihashmap_iterator_next ( 921GNUNET_CONTAINER_multihashmap_iterator_next (
1042 struct GNUNET_CONTAINER_MultiHashMapIterator *iter, 922 struct GNUNET_CONTAINER_MultiHashMapIterator *iter,
@@ -1082,11 +962,6 @@ GNUNET_CONTAINER_multihashmap_iterator_next (
1082} 962}
1083 963
1084 964
1085/**
1086 * Destroy a multihashmap iterator.
1087 *
1088 * @param iter the iterator to destroy
1089 */
1090void 965void
1091GNUNET_CONTAINER_multihashmap_iterator_destroy ( 966GNUNET_CONTAINER_multihashmap_iterator_destroy (
1092 struct GNUNET_CONTAINER_MultiHashMapIterator *iter) 967 struct GNUNET_CONTAINER_MultiHashMapIterator *iter)
diff --git a/src/util/container_multihashmap32.c b/src/util/container_multihashmap32.c
index f349a5f80..ccedd1bbb 100644
--- a/src/util/container_multihashmap32.c
+++ b/src/util/container_multihashmap32.c
@@ -195,12 +195,6 @@ idx_of (const struct GNUNET_CONTAINER_MultiHashMap32 *m, const uint32_t key)
195} 195}
196 196
197 197
198/**
199 * Get the number of key-value pairs in the map.
200 *
201 * @param map the map
202 * @return the number of key value pairs
203 */
204unsigned int 198unsigned int
205GNUNET_CONTAINER_multihashmap32_size ( 199GNUNET_CONTAINER_multihashmap32_size (
206 const struct GNUNET_CONTAINER_MultiHashMap32 *map) 200 const struct GNUNET_CONTAINER_MultiHashMap32 *map)
@@ -209,16 +203,6 @@ GNUNET_CONTAINER_multihashmap32_size (
209} 203}
210 204
211 205
212/**
213 * Given a key find a value in the map matching the key.
214 *
215 * @param map the map
216 * @param key what to look for
217 * @return NULL if no value was found; note that
218 * this is indistinguishable from values that just
219 * happen to be NULL; use "contains" to test for
220 * key-value pairs with value NULL
221 */
222void * 206void *
223GNUNET_CONTAINER_multihashmap32_get ( 207GNUNET_CONTAINER_multihashmap32_get (
224 const struct GNUNET_CONTAINER_MultiHashMap32 *map, 208 const struct GNUNET_CONTAINER_MultiHashMap32 *map,
@@ -237,15 +221,6 @@ GNUNET_CONTAINER_multihashmap32_get (
237} 221}
238 222
239 223
240/**
241 * Iterate over all entries in the map.
242 *
243 * @param map the map
244 * @param it function to call on each entry
245 * @param it_cls extra argument to @a it
246 * @return the number of key value pairs processed,
247 * #GNUNET_SYSERR if it aborted iteration
248 */
249int 224int
250GNUNET_CONTAINER_multihashmap32_iterate ( 225GNUNET_CONTAINER_multihashmap32_iterate (
251 struct GNUNET_CONTAINER_MultiHashMap32 *map, 226 struct GNUNET_CONTAINER_MultiHashMap32 *map,
@@ -300,17 +275,6 @@ update_next_cache (struct GNUNET_CONTAINER_MultiHashMap32 *map,
300} 275}
301 276
302 277
303/**
304 * Remove the given key-value pair from the map. Note that if the
305 * key-value pair is in the map multiple times, only one of the pairs
306 * will be removed.
307 *
308 * @param map the map
309 * @param key key of the key-value pair
310 * @param value value of the key-value pair
311 * @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
312 * is not in the map
313 */
314int 278int
315GNUNET_CONTAINER_multihashmap32_remove ( 279GNUNET_CONTAINER_multihashmap32_remove (
316 struct GNUNET_CONTAINER_MultiHashMap32 *map, 280 struct GNUNET_CONTAINER_MultiHashMap32 *map,
@@ -346,14 +310,6 @@ GNUNET_CONTAINER_multihashmap32_remove (
346} 310}
347 311
348 312
349/**
350 * Remove all entries for the given key from the map.
351 * Note that the values would not be "freed".
352 *
353 * @param map the map
354 * @param key identifies values to be removed
355 * @return number of values removed
356 */
357int 313int
358GNUNET_CONTAINER_multihashmap32_remove_all ( 314GNUNET_CONTAINER_multihashmap32_remove_all (
359 struct GNUNET_CONTAINER_MultiHashMap32 *map, 315 struct GNUNET_CONTAINER_MultiHashMap32 *map,
@@ -397,15 +353,6 @@ GNUNET_CONTAINER_multihashmap32_remove_all (
397} 353}
398 354
399 355
400/**
401 * Check if the map contains any value under the given
402 * key (including values that are NULL).
403 *
404 * @param map the map
405 * @param key the key to test if a value exists for it
406 * @return #GNUNET_YES if such a value exists,
407 * #GNUNET_NO if not
408 */
409int 356int
410GNUNET_CONTAINER_multihashmap32_contains ( 357GNUNET_CONTAINER_multihashmap32_contains (
411 const struct GNUNET_CONTAINER_MultiHashMap32 *map, 358 const struct GNUNET_CONTAINER_MultiHashMap32 *map,
@@ -424,16 +371,6 @@ GNUNET_CONTAINER_multihashmap32_contains (
424} 371}
425 372
426 373
427/**
428 * Check if the map contains the given value under the given
429 * key.
430 *
431 * @param map the map
432 * @param key the key to test if a value exists for it
433 * @param value value to test for
434 * @return #GNUNET_YES if such a value exists,
435 * #GNUNET_NO if not
436 */
437int 374int
438GNUNET_CONTAINER_multihashmap32_contains_value ( 375GNUNET_CONTAINER_multihashmap32_contains_value (
439 const struct GNUNET_CONTAINER_MultiHashMap32 *map, 376 const struct GNUNET_CONTAINER_MultiHashMap32 *map,
@@ -549,16 +486,6 @@ GNUNET_CONTAINER_multihashmap32_put (
549} 486}
550 487
551 488
552/**
553 * Iterate over all entries in the map that match a particular key.
554 *
555 * @param map the map
556 * @param key key that the entries must correspond to
557 * @param it function to call on each entry
558 * @param it_cls extra argument to @a it
559 * @return the number of key value pairs processed,
560 * GNUNET_SYSERR if it aborted iteration
561 */
562int 489int
563GNUNET_CONTAINER_multihashmap32_get_multiple ( 490GNUNET_CONTAINER_multihashmap32_get_multiple (
564 struct GNUNET_CONTAINER_MultiHashMap32 *map, 491 struct GNUNET_CONTAINER_MultiHashMap32 *map,
diff --git a/src/util/container_multipeermap.c b/src/util/container_multipeermap.c
index fa4d2210b..976f172e1 100644
--- a/src/util/container_multipeermap.c
+++ b/src/util/container_multipeermap.c
@@ -174,21 +174,6 @@ struct GNUNET_CONTAINER_MultiPeerMapIterator
174}; 174};
175 175
176 176
177/**
178 * Create a multi hash map.
179 *
180 * @param len initial size (map will grow as needed)
181 * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default;
182 * GNUNET_YES means that on 'put', the 'key' does not have
183 * to be copied as the destination of the pointer is
184 * guaranteed to be life as long as the value is stored in
185 * the hashmap. This can significantly reduce memory
186 * consumption, but of course is also a recipe for
187 * heap corruption if the assumption is not true. Only
188 * use this if (1) memory use is important in this case and
189 * (2) you have triple-checked that the invariant holds
190 * @return NULL on error
191 */
192struct GNUNET_CONTAINER_MultiPeerMap * 177struct GNUNET_CONTAINER_MultiPeerMap *
193GNUNET_CONTAINER_multipeermap_create (unsigned int len, 178GNUNET_CONTAINER_multipeermap_create (unsigned int len,
194 int do_not_copy_keys) 179 int do_not_copy_keys)
@@ -209,12 +194,6 @@ GNUNET_CONTAINER_multipeermap_create (unsigned int len,
209} 194}
210 195
211 196
212/**
213 * Destroy a hash map. Will not free any values
214 * stored in the hash map!
215 *
216 * @param map the map
217 */
218void 197void
219GNUNET_CONTAINER_multipeermap_destroy ( 198GNUNET_CONTAINER_multipeermap_destroy (
220 struct GNUNET_CONTAINER_MultiPeerMap *map) 199 struct GNUNET_CONTAINER_MultiPeerMap *map)
@@ -276,12 +255,6 @@ idx_of (const struct GNUNET_CONTAINER_MultiPeerMap *map,
276} 255}
277 256
278 257
279/**
280 * Get the number of key-value pairs in the map.
281 *
282 * @param map the map
283 * @return the number of key value pairs
284 */
285unsigned int 258unsigned int
286GNUNET_CONTAINER_multipeermap_size ( 259GNUNET_CONTAINER_multipeermap_size (
287 const struct GNUNET_CONTAINER_MultiPeerMap *map) 260 const struct GNUNET_CONTAINER_MultiPeerMap *map)
@@ -290,16 +263,6 @@ GNUNET_CONTAINER_multipeermap_size (
290} 263}
291 264
292 265
293/**
294 * Given a key find a value in the map matching the key.
295 *
296 * @param map the map
297 * @param key what to look for
298 * @return NULL if no value was found; note that
299 * this is indistinguishable from values that just
300 * happen to be NULL; use "contains" to test for
301 * key-value pairs with value NULL
302 */
303void * 266void *
304GNUNET_CONTAINER_multipeermap_get ( 267GNUNET_CONTAINER_multipeermap_get (
305 const struct GNUNET_CONTAINER_MultiPeerMap *map, 268 const struct GNUNET_CONTAINER_MultiPeerMap *map,
@@ -324,15 +287,6 @@ GNUNET_CONTAINER_multipeermap_get (
324} 287}
325 288
326 289
327/**
328 * Iterate over all entries in the map.
329 *
330 * @param map the map
331 * @param it function to call on each entry
332 * @param it_cls extra argument to @a it
333 * @return the number of key value pairs processed,
334 * #GNUNET_SYSERR if it aborted iteration
335 */
336int 290int
337GNUNET_CONTAINER_multipeermap_iterate ( 291GNUNET_CONTAINER_multipeermap_iterate (
338 struct GNUNET_CONTAINER_MultiPeerMap *map, 292 struct GNUNET_CONTAINER_MultiPeerMap *map,
@@ -430,17 +384,6 @@ update_next_cache_sme (struct GNUNET_CONTAINER_MultiPeerMap *map,
430} 384}
431 385
432 386
433/**
434 * Remove the given key-value pair from the map. Note that if the
435 * key-value pair is in the map multiple times, only one of the pairs
436 * will be removed.
437 *
438 * @param map the map
439 * @param key key of the key-value pair
440 * @param value value of the key-value pair
441 * @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
442 * is not in the map
443 */
444int 387int
445GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, 388GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map,
446 const struct GNUNET_PeerIdentity *key, 389 const struct GNUNET_PeerIdentity *key,
@@ -496,14 +439,6 @@ GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map,
496} 439}
497 440
498 441
499/**
500 * Remove all entries for the given key from the map.
501 * Note that the values would not be "freed".
502 *
503 * @param map the map
504 * @param key identifies values to be removed
505 * @return number of values removed
506 */
507int 442int
508GNUNET_CONTAINER_multipeermap_remove_all ( 443GNUNET_CONTAINER_multipeermap_remove_all (
509 struct GNUNET_CONTAINER_MultiPeerMap *map, 444 struct GNUNET_CONTAINER_MultiPeerMap *map,
@@ -584,15 +519,6 @@ GNUNET_CONTAINER_multipeermap_remove_all (
584} 519}
585 520
586 521
587/**
588 * Check if the map contains any value under the given
589 * key (including values that are NULL).
590 *
591 * @param map the map
592 * @param key the key to test if a value exists for it
593 * @return #GNUNET_YES if such a value exists,
594 * #GNUNET_NO if not
595 */
596int 522int
597GNUNET_CONTAINER_multipeermap_contains ( 523GNUNET_CONTAINER_multipeermap_contains (
598 const struct GNUNET_CONTAINER_MultiPeerMap *map, 524 const struct GNUNET_CONTAINER_MultiPeerMap *map,
@@ -617,16 +543,6 @@ GNUNET_CONTAINER_multipeermap_contains (
617} 543}
618 544
619 545
620/**
621 * Check if the map contains the given value under the given
622 * key.
623 *
624 * @param map the map
625 * @param key the key to test if a value exists for it
626 * @param value value to test for
627 * @return #GNUNET_YES if such a value exists,
628 * #GNUNET_NO if not
629 */
630int 546int
631GNUNET_CONTAINER_multipeermap_contains_value ( 547GNUNET_CONTAINER_multipeermap_contains_value (
632 const struct GNUNET_CONTAINER_MultiPeerMap *map, 548 const struct GNUNET_CONTAINER_MultiPeerMap *map,
@@ -711,18 +627,6 @@ grow (struct GNUNET_CONTAINER_MultiPeerMap *map)
711} 627}
712 628
713 629
714/**
715 * Store a key-value pair in the map.
716 *
717 * @param map the map
718 * @param key key to use
719 * @param value value to use
720 * @param opt options for put
721 * @return #GNUNET_OK on success,
722 * #GNUNET_NO if a value was replaced (with REPLACE)
723 * #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY was the option and the
724 * value already exists
725 */
726int 630int
727GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, 631GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map,
728 const struct GNUNET_PeerIdentity *key, 632 const struct GNUNET_PeerIdentity *key,
@@ -794,16 +698,6 @@ GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map,
794} 698}
795 699
796 700
797/**
798 * Iterate over all entries in the map that match a particular key.
799 *
800 * @param map the map
801 * @param key key that the entries must correspond to
802 * @param it function to call on each entry
803 * @param it_cls extra argument to @a it
804 * @return the number of key value pairs processed,
805 * #GNUNET_SYSERR if it aborted iteration
806 */
807int 701int
808GNUNET_CONTAINER_multipeermap_get_multiple ( 702GNUNET_CONTAINER_multipeermap_get_multiple (
809 struct GNUNET_CONTAINER_MultiPeerMap *map, 703 struct GNUNET_CONTAINER_MultiPeerMap *map,
@@ -930,18 +824,6 @@ GNUNET_CONTAINER_multipeermap_get_random (
930} 824}
931 825
932 826
933/**
934 * Create an iterator for a multipeermap.
935 * The iterator can be used to retrieve all the elements in the multipeermap
936 * one by one, without having to handle all elements at once (in contrast to
937 * #GNUNET_CONTAINER_multipeermap_iterate). Note that the iterator can not be
938 * used anymore if elements have been removed from 'map' after the creation of
939 * the iterator, or 'map' has been destroyed. Adding elements to 'map' may
940 * result in skipped or repeated elements.
941 *
942 * @param map the map to create an iterator for
943 * @return an iterator over the given multipeermap 'map'
944 */
945struct GNUNET_CONTAINER_MultiPeerMapIterator * 827struct GNUNET_CONTAINER_MultiPeerMapIterator *
946GNUNET_CONTAINER_multipeermap_iterator_create ( 828GNUNET_CONTAINER_multipeermap_iterator_create (
947 const struct GNUNET_CONTAINER_MultiPeerMap *map) 829 const struct GNUNET_CONTAINER_MultiPeerMap *map)
@@ -956,20 +838,6 @@ GNUNET_CONTAINER_multipeermap_iterator_create (
956} 838}
957 839
958 840
959/**
960 * Retrieve the next element from the hash map at the iterator's position.
961 * If there are no elements left, GNUNET_NO is returned, and 'key' and 'value'
962 * are not modified.
963 * This operation is only allowed if no elements have been removed from the
964 * multipeermap since the creation of 'iter', and the map has not been destroyed.
965 * Adding elements may result in repeating or skipping elements.
966 *
967 * @param iter the iterator to get the next element from
968 * @param key pointer to store the key in, can be NULL
969 * @param value pointer to store the value in, can be NULL
970 * @return #GNUNET_YES we returned an element,
971 * #GNUNET_NO if we are out of elements
972 */
973int 841int
974GNUNET_CONTAINER_multipeermap_iterator_next ( 842GNUNET_CONTAINER_multipeermap_iterator_next (
975 struct GNUNET_CONTAINER_MultiPeerMapIterator *iter, 843 struct GNUNET_CONTAINER_MultiPeerMapIterator *iter,
@@ -1015,11 +883,6 @@ GNUNET_CONTAINER_multipeermap_iterator_next (
1015} 883}
1016 884
1017 885
1018/**
1019 * Destroy a multipeermap iterator.
1020 *
1021 * @param iter the iterator to destroy
1022 */
1023void 886void
1024GNUNET_CONTAINER_multipeermap_iterator_destroy ( 887GNUNET_CONTAINER_multipeermap_iterator_destroy (
1025 struct GNUNET_CONTAINER_MultiPeerMapIterator *iter) 888 struct GNUNET_CONTAINER_MultiPeerMapIterator *iter)
diff --git a/src/util/container_multishortmap.c b/src/util/container_multishortmap.c
index 77e5ca139..a02d55770 100644
--- a/src/util/container_multishortmap.c
+++ b/src/util/container_multishortmap.c
@@ -209,12 +209,6 @@ GNUNET_CONTAINER_multishortmap_create (unsigned int len, int do_not_copy_keys)
209} 209}
210 210
211 211
212/**
213 * Destroy a hash map. Will not free any values
214 * stored in the hash map!
215 *
216 * @param map the map
217 */
218void 212void
219GNUNET_CONTAINER_multishortmap_destroy ( 213GNUNET_CONTAINER_multishortmap_destroy (
220 struct GNUNET_CONTAINER_MultiShortmap *map) 214 struct GNUNET_CONTAINER_MultiShortmap *map)
@@ -276,12 +270,6 @@ idx_of (const struct GNUNET_CONTAINER_MultiShortmap *map,
276} 270}
277 271
278 272
279/**
280 * Get the number of key-value pairs in the map.
281 *
282 * @param map the map
283 * @return the number of key value pairs
284 */
285unsigned int 273unsigned int
286GNUNET_CONTAINER_multishortmap_size ( 274GNUNET_CONTAINER_multishortmap_size (
287 const struct GNUNET_CONTAINER_MultiShortmap *map) 275 const struct GNUNET_CONTAINER_MultiShortmap *map)
@@ -290,16 +278,6 @@ GNUNET_CONTAINER_multishortmap_size (
290} 278}
291 279
292 280
293/**
294 * Given a key find a value in the map matching the key.
295 *
296 * @param map the map
297 * @param key what to look for
298 * @return NULL if no value was found; note that
299 * this is indistinguishable from values that just
300 * happen to be NULL; use "contains" to test for
301 * key-value pairs with value NULL
302 */
303void * 281void *
304GNUNET_CONTAINER_multishortmap_get ( 282GNUNET_CONTAINER_multishortmap_get (
305 const struct GNUNET_CONTAINER_MultiShortmap *map, 283 const struct GNUNET_CONTAINER_MultiShortmap *map,
@@ -324,15 +302,6 @@ GNUNET_CONTAINER_multishortmap_get (
324} 302}
325 303
326 304
327/**
328 * Iterate over all entries in the map.
329 *
330 * @param map the map
331 * @param it function to call on each entry
332 * @param it_cls extra argument to @a it
333 * @return the number of key value pairs processed,
334 * #GNUNET_SYSERR if it aborted iteration
335 */
336int 305int
337GNUNET_CONTAINER_multishortmap_iterate ( 306GNUNET_CONTAINER_multishortmap_iterate (
338 struct GNUNET_CONTAINER_MultiShortmap *map, 307 struct GNUNET_CONTAINER_MultiShortmap *map,
@@ -427,17 +396,6 @@ update_next_cache_sme (struct GNUNET_CONTAINER_MultiShortmap *map,
427} 396}
428 397
429 398
430/**
431 * Remove the given key-value pair from the map. Note that if the
432 * key-value pair is in the map multiple times, only one of the pairs
433 * will be removed.
434 *
435 * @param map the map
436 * @param key key of the key-value pair
437 * @param value value of the key-value pair
438 * @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
439 * is not in the map
440 */
441int 399int
442GNUNET_CONTAINER_multishortmap_remove ( 400GNUNET_CONTAINER_multishortmap_remove (
443 struct GNUNET_CONTAINER_MultiShortmap *map, 401 struct GNUNET_CONTAINER_MultiShortmap *map,
@@ -494,14 +452,6 @@ GNUNET_CONTAINER_multishortmap_remove (
494} 452}
495 453
496 454
497/**
498 * Remove all entries for the given key from the map.
499 * Note that the values would not be "freed".
500 *
501 * @param map the map
502 * @param key identifies values to be removed
503 * @return number of values removed
504 */
505int 455int
506GNUNET_CONTAINER_multishortmap_remove_all ( 456GNUNET_CONTAINER_multishortmap_remove_all (
507 struct GNUNET_CONTAINER_MultiShortmap *map, 457 struct GNUNET_CONTAINER_MultiShortmap *map,
@@ -582,15 +532,6 @@ GNUNET_CONTAINER_multishortmap_remove_all (
582} 532}
583 533
584 534
585/**
586 * Check if the map contains any value under the given
587 * key (including values that are NULL).
588 *
589 * @param map the map
590 * @param key the key to test if a value exists for it
591 * @return #GNUNET_YES if such a value exists,
592 * #GNUNET_NO if not
593 */
594int 535int
595GNUNET_CONTAINER_multishortmap_contains ( 536GNUNET_CONTAINER_multishortmap_contains (
596 const struct GNUNET_CONTAINER_MultiShortmap *map, 537 const struct GNUNET_CONTAINER_MultiShortmap *map,
@@ -615,16 +556,6 @@ GNUNET_CONTAINER_multishortmap_contains (
615} 556}
616 557
617 558
618/**
619 * Check if the map contains the given value under the given
620 * key.
621 *
622 * @param map the map
623 * @param key the key to test if a value exists for it
624 * @param value value to test for
625 * @return #GNUNET_YES if such a value exists,
626 * #GNUNET_NO if not
627 */
628int 559int
629GNUNET_CONTAINER_multishortmap_contains_value ( 560GNUNET_CONTAINER_multishortmap_contains_value (
630 const struct GNUNET_CONTAINER_MultiShortmap *map, 561 const struct GNUNET_CONTAINER_MultiShortmap *map,
@@ -708,18 +639,6 @@ grow (struct GNUNET_CONTAINER_MultiShortmap *map)
708} 639}
709 640
710 641
711/**
712 * Store a key-value pair in the map.
713 *
714 * @param map the map
715 * @param key key to use
716 * @param value value to use
717 * @param opt options for put
718 * @return #GNUNET_OK on success,
719 * #GNUNET_NO if a value was replaced (with REPLACE)
720 * #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY was the option and the
721 * value already exists
722 */
723int 642int
724GNUNET_CONTAINER_multishortmap_put ( 643GNUNET_CONTAINER_multishortmap_put (
725 struct GNUNET_CONTAINER_MultiShortmap *map, 644 struct GNUNET_CONTAINER_MultiShortmap *map,
@@ -914,18 +833,6 @@ GNUNET_CONTAINER_multishortmap_get_random (
914} 833}
915 834
916 835
917/**
918 * Create an iterator for a multishortmap.
919 * The iterator can be used to retrieve all the elements in the multishortmap
920 * one by one, without having to handle all elements at once (in contrast to
921 * #GNUNET_CONTAINER_multishortmap_iterate). Note that the iterator can not be
922 * used anymore if elements have been removed from 'map' after the creation of
923 * the iterator, or 'map' has been destroyed. Adding elements to 'map' may
924 * result in skipped or repeated elements.
925 *
926 * @param map the map to create an iterator for
927 * @return an iterator over the given multishortmap 'map'
928 */
929struct GNUNET_CONTAINER_MultiShortmapIterator * 836struct GNUNET_CONTAINER_MultiShortmapIterator *
930GNUNET_CONTAINER_multishortmap_iterator_create ( 837GNUNET_CONTAINER_multishortmap_iterator_create (
931 const struct GNUNET_CONTAINER_MultiShortmap *map) 838 const struct GNUNET_CONTAINER_MultiShortmap *map)
@@ -940,20 +847,6 @@ GNUNET_CONTAINER_multishortmap_iterator_create (
940} 847}
941 848
942 849
943/**
944 * Retrieve the next element from the hash map at the iterator's position.
945 * If there are no elements left, GNUNET_NO is returned, and 'key' and 'value'
946 * are not modified.
947 * This operation is only allowed if no elements have been removed from the
948 * multishortmap since the creation of 'iter', and the map has not been destroyed.
949 * Adding elements may result in repeating or skipping elements.
950 *
951 * @param iter the iterator to get the next element from
952 * @param key pointer to store the key in, can be NULL
953 * @param value pointer to store the value in, can be NULL
954 * @return #GNUNET_YES we returned an element,
955 * #GNUNET_NO if we are out of elements
956 */
957int 850int
958GNUNET_CONTAINER_multishortmap_iterator_next ( 851GNUNET_CONTAINER_multishortmap_iterator_next (
959 struct GNUNET_CONTAINER_MultiShortmapIterator *iter, 852 struct GNUNET_CONTAINER_MultiShortmapIterator *iter,
@@ -999,11 +892,6 @@ GNUNET_CONTAINER_multishortmap_iterator_next (
999} 892}
1000 893
1001 894
1002/**
1003 * Destroy a multishortmap iterator.
1004 *
1005 * @param iter the iterator to destroy
1006 */
1007void 895void
1008GNUNET_CONTAINER_multishortmap_iterator_destroy ( 896GNUNET_CONTAINER_multishortmap_iterator_destroy (
1009 struct GNUNET_CONTAINER_MultiShortmapIterator *iter) 897 struct GNUNET_CONTAINER_MultiShortmapIterator *iter)
diff --git a/src/util/container_multiuuidmap.c b/src/util/container_multiuuidmap.c
index f2ed304b3..fbc4c8c39 100644
--- a/src/util/container_multiuuidmap.c
+++ b/src/util/container_multiuuidmap.c
@@ -209,12 +209,6 @@ GNUNET_CONTAINER_multiuuidmap_create (unsigned int len, int do_not_copy_keys)
209} 209}
210 210
211 211
212/**
213 * Destroy a hash map. Will not free any values
214 * stored in the hash map!
215 *
216 * @param map the map
217 */
218void 212void
219GNUNET_CONTAINER_multiuuidmap_destroy ( 213GNUNET_CONTAINER_multiuuidmap_destroy (
220 struct GNUNET_CONTAINER_MultiUuidmap *map) 214 struct GNUNET_CONTAINER_MultiUuidmap *map)
@@ -276,12 +270,6 @@ idx_of (const struct GNUNET_CONTAINER_MultiUuidmap *map,
276} 270}
277 271
278 272
279/**
280 * Get the number of key-value pairs in the map.
281 *
282 * @param map the map
283 * @return the number of key value pairs
284 */
285unsigned int 273unsigned int
286GNUNET_CONTAINER_multiuuidmap_size ( 274GNUNET_CONTAINER_multiuuidmap_size (
287 const struct GNUNET_CONTAINER_MultiUuidmap *map) 275 const struct GNUNET_CONTAINER_MultiUuidmap *map)
@@ -290,16 +278,6 @@ GNUNET_CONTAINER_multiuuidmap_size (
290} 278}
291 279
292 280
293/**
294 * Given a key find a value in the map matching the key.
295 *
296 * @param map the map
297 * @param key what to look for
298 * @return NULL if no value was found; note that
299 * this is indistinguishable from values that just
300 * happen to be NULL; use "contains" to test for
301 * key-value pairs with value NULL
302 */
303void * 281void *
304GNUNET_CONTAINER_multiuuidmap_get ( 282GNUNET_CONTAINER_multiuuidmap_get (
305 const struct GNUNET_CONTAINER_MultiUuidmap *map, 283 const struct GNUNET_CONTAINER_MultiUuidmap *map,
@@ -324,15 +302,6 @@ GNUNET_CONTAINER_multiuuidmap_get (
324} 302}
325 303
326 304
327/**
328 * Iterate over all entries in the map.
329 *
330 * @param map the map
331 * @param it function to call on each entry
332 * @param it_cls extra argument to @a it
333 * @return the number of key value pairs processed,
334 * #GNUNET_SYSERR if it aborted iteration
335 */
336int 305int
337GNUNET_CONTAINER_multiuuidmap_iterate ( 306GNUNET_CONTAINER_multiuuidmap_iterate (
338 struct GNUNET_CONTAINER_MultiUuidmap *map, 307 struct GNUNET_CONTAINER_MultiUuidmap *map,
@@ -427,17 +396,6 @@ update_next_cache_sme (struct GNUNET_CONTAINER_MultiUuidmap *map,
427} 396}
428 397
429 398
430/**
431 * Remove the given key-value pair from the map. Note that if the
432 * key-value pair is in the map multiple times, only one of the pairs
433 * will be removed.
434 *
435 * @param map the map
436 * @param key key of the key-value pair
437 * @param value value of the key-value pair
438 * @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
439 * is not in the map
440 */
441int 399int
442GNUNET_CONTAINER_multiuuidmap_remove (struct GNUNET_CONTAINER_MultiUuidmap *map, 400GNUNET_CONTAINER_multiuuidmap_remove (struct GNUNET_CONTAINER_MultiUuidmap *map,
443 const struct GNUNET_Uuid *key, 401 const struct GNUNET_Uuid *key,
@@ -493,14 +451,6 @@ GNUNET_CONTAINER_multiuuidmap_remove (struct GNUNET_CONTAINER_MultiUuidmap *map,
493} 451}
494 452
495 453
496/**
497 * Remove all entries for the given key from the map.
498 * Note that the values would not be "freed".
499 *
500 * @param map the map
501 * @param key identifies values to be removed
502 * @return number of values removed
503 */
504int 454int
505GNUNET_CONTAINER_multiuuidmap_remove_all ( 455GNUNET_CONTAINER_multiuuidmap_remove_all (
506 struct GNUNET_CONTAINER_MultiUuidmap *map, 456 struct GNUNET_CONTAINER_MultiUuidmap *map,
@@ -581,15 +531,6 @@ GNUNET_CONTAINER_multiuuidmap_remove_all (
581} 531}
582 532
583 533
584/**
585 * Check if the map contains any value under the given
586 * key (including values that are NULL).
587 *
588 * @param map the map
589 * @param key the key to test if a value exists for it
590 * @return #GNUNET_YES if such a value exists,
591 * #GNUNET_NO if not
592 */
593int 534int
594GNUNET_CONTAINER_multiuuidmap_contains ( 535GNUNET_CONTAINER_multiuuidmap_contains (
595 const struct GNUNET_CONTAINER_MultiUuidmap *map, 536 const struct GNUNET_CONTAINER_MultiUuidmap *map,
@@ -614,16 +555,6 @@ GNUNET_CONTAINER_multiuuidmap_contains (
614} 555}
615 556
616 557
617/**
618 * Check if the map contains the given value under the given
619 * key.
620 *
621 * @param map the map
622 * @param key the key to test if a value exists for it
623 * @param value value to test for
624 * @return #GNUNET_YES if such a value exists,
625 * #GNUNET_NO if not
626 */
627int 558int
628GNUNET_CONTAINER_multiuuidmap_contains_value ( 559GNUNET_CONTAINER_multiuuidmap_contains_value (
629 const struct GNUNET_CONTAINER_MultiUuidmap *map, 560 const struct GNUNET_CONTAINER_MultiUuidmap *map,
@@ -707,18 +638,6 @@ grow (struct GNUNET_CONTAINER_MultiUuidmap *map)
707} 638}
708 639
709 640
710/**
711 * Store a key-value pair in the map.
712 *
713 * @param map the map
714 * @param key key to use
715 * @param value value to use
716 * @param opt options for put
717 * @return #GNUNET_OK on success,
718 * #GNUNET_NO if a value was replaced (with REPLACE)
719 * #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY was the option and the
720 * value already exists
721 */
722int 641int
723GNUNET_CONTAINER_multiuuidmap_put (struct GNUNET_CONTAINER_MultiUuidmap *map, 642GNUNET_CONTAINER_multiuuidmap_put (struct GNUNET_CONTAINER_MultiUuidmap *map,
724 const struct GNUNET_Uuid *key, 643 const struct GNUNET_Uuid *key,
@@ -912,18 +831,6 @@ GNUNET_CONTAINER_multiuuidmap_get_random (
912} 831}
913 832
914 833
915/**
916 * Create an iterator for a multiuuidmap.
917 * The iterator can be used to retrieve all the elements in the multiuuidmap
918 * one by one, without having to handle all elements at once (in contrast to
919 * #GNUNET_CONTAINER_multiuuidmap_iterate). Note that the iterator can not be
920 * used anymore if elements have been removed from 'map' after the creation of
921 * the iterator, or 'map' has been destroyed. Adding elements to 'map' may
922 * result in skipped or repeated elements.
923 *
924 * @param map the map to create an iterator for
925 * @return an iterator over the given multiuuidmap 'map'
926 */
927struct GNUNET_CONTAINER_MultiUuidmapIterator * 834struct GNUNET_CONTAINER_MultiUuidmapIterator *
928GNUNET_CONTAINER_multiuuidmap_iterator_create ( 835GNUNET_CONTAINER_multiuuidmap_iterator_create (
929 const struct GNUNET_CONTAINER_MultiUuidmap *map) 836 const struct GNUNET_CONTAINER_MultiUuidmap *map)
@@ -938,20 +845,6 @@ GNUNET_CONTAINER_multiuuidmap_iterator_create (
938} 845}
939 846
940 847
941/**
942 * Retrieve the next element from the hash map at the iterator's position.
943 * If there are no elements left, GNUNET_NO is returned, and 'key' and 'value'
944 * are not modified.
945 * This operation is only allowed if no elements have been removed from the
946 * multiuuidmap since the creation of 'iter', and the map has not been destroyed.
947 * Adding elements may result in repeating or skipping elements.
948 *
949 * @param iter the iterator to get the next element from
950 * @param key pointer to store the key in, can be NULL
951 * @param value pointer to store the value in, can be NULL
952 * @return #GNUNET_YES we returned an element,
953 * #GNUNET_NO if we are out of elements
954 */
955int 848int
956GNUNET_CONTAINER_multiuuidmap_iterator_next ( 849GNUNET_CONTAINER_multiuuidmap_iterator_next (
957 struct GNUNET_CONTAINER_MultiUuidmapIterator *iter, 850 struct GNUNET_CONTAINER_MultiUuidmapIterator *iter,
@@ -997,11 +890,6 @@ GNUNET_CONTAINER_multiuuidmap_iterator_next (
997} 890}
998 891
999 892
1000/**
1001 * Destroy a multiuuidmap iterator.
1002 *
1003 * @param iter the iterator to destroy
1004 */
1005void 893void
1006GNUNET_CONTAINER_multiuuidmap_iterator_destroy ( 894GNUNET_CONTAINER_multiuuidmap_iterator_destroy (
1007 struct GNUNET_CONTAINER_MultiUuidmapIterator *iter) 895 struct GNUNET_CONTAINER_MultiUuidmapIterator *iter)