aboutsummaryrefslogtreecommitdiff
path: root/src/util/container_multihashmap.c
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2012-10-07 18:19:32 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2012-10-07 18:19:32 +0000
commitd2aa7382c64c60f0ca6aaf3c839cc2b5f5356d0c (patch)
tree6dcbbf91d734834f804b2fd9ab790244e2d60e6c /src/util/container_multihashmap.c
parent0b3762b5f5400ae9b6d23ee729a7aa74724cef37 (diff)
-chaning multihashmap API to allow option for avoiding key allocation
git-svn-id: https://gnunet.org/svn/gnunet@24216 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/util/container_multihashmap.c')
-rw-r--r--src/util/container_multihashmap.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c
index ada98251cc..4a41fd0159 100644
--- a/src/util/container_multihashmap.c
+++ b/src/util/container_multihashmap.c
@@ -80,10 +80,20 @@ struct GNUNET_CONTAINER_MultiHashMap
* Create a multi hash map.
*
* @param len initial size (map will grow as needed)
+ * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default;
+ * GNUNET_YES means that on 'put', the 'key' does not have
+ * to be copied as the destination of the pointer is
+ * guaranteed to be life as long as the value is stored in
+ * the hashmap. This can significantly reduce memory
+ * consumption, but of course is also a recipie for
+ * heap corruption if the assumption is not true. Only
+ * use this if (1) memory use is important in this case and
+ * (2) you have triple-checked that the invariant holds
* @return NULL on error
*/
struct GNUNET_CONTAINER_MultiHashMap *
-GNUNET_CONTAINER_multihashmap_create (unsigned int len)
+GNUNET_CONTAINER_multihashmap_create (unsigned int len,
+ int do_not_copy_keys)
{
struct GNUNET_CONTAINER_MultiHashMap *ret;