diff options
author | Elijah Newren <newren@gmail.com> | 2020-11-02 19:55:05 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-11-02 21:15:50 +0100 |
commit | 6da1a258142ac2422c8c57c54b92eaed3c86226e (patch) | |
tree | 480a35cb1c8754d02f21233d2efd8e5d28ff24d0 /patch-ids.c | |
parent | hashmap: introduce a new hashmap_partial_clear() (diff) | |
download | git-6da1a258142ac2422c8c57c54b92eaed3c86226e.tar.xz git-6da1a258142ac2422c8c57c54b92eaed3c86226e.zip |
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 'patch-ids.c')
-rw-r--r-- | patch-ids.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/patch-ids.c b/patch-ids.c index 12aa6d494b..21973e4933 100644 --- a/patch-ids.c +++ b/patch-ids.c @@ -71,7 +71,7 @@ int init_patch_ids(struct repository *r, struct patch_ids *ids) int free_patch_ids(struct patch_ids *ids) { - hashmap_free_entries(&ids->patches, struct patch_id, ent); + hashmap_clear_and_free(&ids->patches, struct patch_id, ent); return 0; } |