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/util/container_multihashmap.c | |
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/util/container_multihashmap.c')
-rw-r--r-- | src/util/container_multihashmap.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c index ada98251c..4a41fd015 100644 --- a/src/util/container_multihashmap.c +++ b/src/util/container_multihashmap.c | |||
@@ -80,10 +80,20 @@ struct GNUNET_CONTAINER_MultiHashMap | |||
80 | * Create a multi hash map. | 80 | * Create a multi hash map. |
81 | * | 81 | * |
82 | * @param len initial size (map will grow as needed) | 82 | * @param len initial size (map will grow as needed) |
83 | * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; | ||
84 | * GNUNET_YES means that on 'put', the 'key' does not have | ||
85 | * to be copied as the destination of the pointer is | ||
86 | * guaranteed to be life as long as the value is stored in | ||
87 | * the hashmap. This can significantly reduce memory | ||
88 | * consumption, but of course is also a recipie for | ||
89 | * heap corruption if the assumption is not true. Only | ||
90 | * use this if (1) memory use is important in this case and | ||
91 | * (2) you have triple-checked that the invariant holds | ||
83 | * @return NULL on error | 92 | * @return NULL on error |
84 | */ | 93 | */ |
85 | struct GNUNET_CONTAINER_MultiHashMap * | 94 | struct GNUNET_CONTAINER_MultiHashMap * |
86 | GNUNET_CONTAINER_multihashmap_create (unsigned int len) | 95 | GNUNET_CONTAINER_multihashmap_create (unsigned int len, |
96 | int do_not_copy_keys) | ||
87 | { | 97 | { |
88 | struct GNUNET_CONTAINER_MultiHashMap *ret; | 98 | struct GNUNET_CONTAINER_MultiHashMap *ret; |
89 | 99 | ||