summaryrefslogtreecommitdiff
path: root/epan/wmem/wmem_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'epan/wmem/wmem_map.h')
-rw-r--r--epan/wmem/wmem_map.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/epan/wmem/wmem_map.h b/epan/wmem/wmem_map.h
index 3e10c9a6dc..1ea4cf3350 100644
--- a/epan/wmem/wmem_map.h
+++ b/epan/wmem/wmem_map.h
@@ -70,6 +70,24 @@ wmem_map_new(wmem_allocator_t *allocator,
GHashFunc hash_func, GEqualFunc eql_func)
G_GNUC_MALLOC;
+/** Creates a map with two allocator scopes. The base structure lives in the
+ * master scope, however the data lives in the slave scope. Every time free_all
+ * occurs in the slave scope the map is transparently emptied without affecting
+ * the location of the master structure.
+ *
+ * WARNING: None of the map (even the part in the master scope) can be used
+ * after the slave scope has been *destroyed*.
+ *
+ * The primary use for this function is to create maps that reset for each new
+ * capture file that is loaded. This can be done by specifying wmem_epan_scope()
+ * as the master and wmem_file_scope() as the slave.
+ */
+WS_DLL_PUBLIC
+wmem_map_t *
+wmem_map_new_autoreset(wmem_allocator_t *master, wmem_allocator_t *slave,
+ GHashFunc hash_func, GEqualFunc eql_func)
+G_GNUC_MALLOC;
+
/** Inserts a value into the map.
*
* @param map The map to insert into.