diff options
-rw-r--r-- | strmap.c | 6 | ||||
-rw-r--r-- | strmap.h | 6 |
2 files changed, 12 insertions, 0 deletions
@@ -64,6 +64,12 @@ void strmap_clear(struct strmap *map, int free_values) hashmap_clear(&map->map); } +void strmap_partial_clear(struct strmap *map, int free_values) +{ + strmap_free_entries_(map, free_values); + hashmap_partial_clear(&map->map); +} + void *strmap_put(struct strmap *map, const char *str, void *data) { struct strmap_entry *entry = find_strmap_entry(map, str); @@ -43,6 +43,12 @@ void strmap_init_with_options(struct strmap *map, void strmap_clear(struct strmap *map, int free_values); /* + * Similar to strmap_clear() but leaves map->map->table allocated and + * pre-sized so that subsequent uses won't need as many rehashings. + */ +void strmap_partial_clear(struct strmap *map, int free_values); + +/* * Insert "str" into the map, pointing to "data". * * If an entry for "str" already exists, its data pointer is overwritten, and |