aboutsummaryrefslogtreecommitdiffstats
path: root/name-hash.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2020-11-02 18:55:05 +0000
committerJunio C Hamano <gitster@pobox.com>2020-11-02 12:15:50 -0800
commit6da1a258142ac2422c8c57c54b92eaed3c86226e (patch)
tree480a35cb1c8754d02f21233d2efd8e5d28ff24d0 /name-hash.c
parent33f20d82177871225e17d9dd44169a52a36c9f1d (diff)
downloadgit-6da1a258142ac2422c8c57c54b92eaed3c86226e.tar.gz
hashmap: provide deallocation function names
hashmap_free(), hashmap_free_entries(), and hashmap_free_() have existed for a while, but aren't necessarily the clearest names, especially with hashmap_partial_clear() being added to the mix and lazy-initialization now being supported. Peff suggested we adopt the following names[1]: - hashmap_clear() - remove all entries and de-allocate any hashmap-specific data, but be ready for reuse - hashmap_clear_and_free() - ditto, but free the entries themselves - hashmap_partial_clear() - remove all entries but don't deallocate table - hashmap_partial_clear_and_free() - ditto, but free the entries This patch provides the new names and converts all existing callers over to the new naming scheme. [1] https://lore.kernel.org/git/20201030125059.GA3277724@coredump.intra.peff.net/ Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'name-hash.c')
-rw-r--r--name-hash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/name-hash.c b/name-hash.c
index fb526a3775..5d3c7b12c1 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -726,6 +726,6 @@ void free_name_hash(struct index_state *istate)
return;
istate->name_hash_initialized = 0;
- hashmap_free(&istate->name_hash);
- hashmap_free_entries(&istate->dir_hash, struct dir_entry, ent);
+ hashmap_clear(&istate->name_hash);
+ hashmap_clear_and_free(&istate->dir_hash, struct dir_entry, ent);
}