diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-10-07 18:19:32 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-10-07 18:19:32 +0000 |
commit | a60b958f984d08525b636a2c7eae564ebec54ae6 (patch) | |
tree | 6dcbbf91d734834f804b2fd9ab790244e2d60e6c /src/include | |
parent | decf459805cdb3f6811f979df4831bc2ce9a2858 (diff) | |
download | gnunet-a60b958f984d08525b636a2c7eae564ebec54ae6.tar.gz gnunet-a60b958f984d08525b636a2c7eae564ebec54ae6.zip |
-chaning multihashmap API to allow option for avoiding key allocation
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_container_lib.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index 96946d02d..a476b7f1b 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h | |||
@@ -542,10 +542,20 @@ typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls, | |||
542 | * Create a multi hash map. | 542 | * Create a multi hash map. |
543 | * | 543 | * |
544 | * @param len initial size (map will grow as needed) | 544 | * @param len initial size (map will grow as needed) |
545 | * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; | ||
546 | * GNUNET_YES means that on 'put', the 'key' does not have | ||
547 | * to be copied as the destination of the pointer is | ||
548 | * guaranteed to be life as long as the value is stored in | ||
549 | * the hashmap. This can significantly reduce memory | ||
550 | * consumption, but of course is also a recipie for | ||
551 | * heap corruption if the assumption is not true. Only | ||
552 | * use this if (1) memory use is important in this case and | ||
553 | * (2) you have triple-checked that the invariant holds | ||
545 | * @return NULL on error | 554 | * @return NULL on error |
546 | */ | 555 | */ |
547 | struct GNUNET_CONTAINER_MultiHashMap * | 556 | struct GNUNET_CONTAINER_MultiHashMap * |
548 | GNUNET_CONTAINER_multihashmap_create (unsigned int len); | 557 | GNUNET_CONTAINER_multihashmap_create (unsigned int len, |
558 | int do_not_copy_keys); | ||
549 | 559 | ||
550 | 560 | ||
551 | /** | 561 | /** |