summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-11-21 15:14:38 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-11-21 15:14:38 -0800
commitbf0a430f70b53f94454692c9ae8ddadd18891aaa (patch)
tree0f55c315bc012df4f7fe235f1606b931625833d3 /dir.c
parentMerge branch 'jk/diff-release-filespec-fix' (diff)
parentshortlog: use strset from strmap.h (diff)
downloadtgif-bf0a430f70b53f94454692c9ae8ddadd18891aaa.tar.xz
Merge branch 'en/strmap'
A specialization of hashmap that uses a string as key has been introduced. Hopefully it will see wider use over time. * en/strmap: shortlog: use strset from strmap.h Use new HASHMAP_INIT macro to simplify hashmap initialization strmap: take advantage of FLEXPTR_ALLOC_STR when relevant strmap: enable allocations to come from a mem_pool strmap: add a strset sub-type strmap: split create_entry() out of strmap_put() strmap: add functions facilitating use as a string->int map strmap: enable faster clearing and reusing of strmaps strmap: add more utility functions strmap: new utility functions hashmap: provide deallocation function names hashmap: introduce a new hashmap_partial_clear() hashmap: allow re-use after hashmap_free() hashmap: adjust spacing to fix argument alignment hashmap: add usage documentation explaining hashmap_free[_entries]()
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dir.c b/dir.c
index ebea5f1f91..d637461da5 100644
--- a/dir.c
+++ b/dir.c
@@ -817,8 +817,8 @@ static void add_pattern_to_hashsets(struct pattern_list *pl, struct path_pattern
clear_hashmaps:
warning(_("disabling cone pattern matching"));
- hashmap_free_entries(&pl->parent_hashmap, struct pattern_entry, ent);
- hashmap_free_entries(&pl->recursive_hashmap, struct pattern_entry, ent);
+ hashmap_clear_and_free(&pl->parent_hashmap, struct pattern_entry, ent);
+ hashmap_clear_and_free(&pl->recursive_hashmap, struct pattern_entry, ent);
pl->use_cone_patterns = 0;
}
@@ -921,8 +921,8 @@ void clear_pattern_list(struct pattern_list *pl)
free(pl->patterns[i]);
free(pl->patterns);
free(pl->filebuf);
- hashmap_free_entries(&pl->recursive_hashmap, struct pattern_entry, ent);
- hashmap_free_entries(&pl->parent_hashmap, struct pattern_entry, ent);
+ hashmap_clear_and_free(&pl->recursive_hashmap, struct pattern_entry, ent);
+ hashmap_clear_and_free(&pl->parent_hashmap, struct pattern_entry, ent);
memset(pl, 0, sizeof(*pl));
}