diff options
author | Eric Wong <e@80x24.org> | 2019-10-06 23:30:40 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-07 10:20:11 +0900 |
commit | c8e424c9c94d97b18cd335be17f32a8ce94a5b7f (patch) | |
tree | e8e652183caac5ad5943e423076585889b02d9b3 /builtin | |
parent | hashmap: hashmap_{put,remove} return hashmap_entry * (diff) | |
download | tgif-c8e424c9c94d97b18cd335be17f32a8ce94a5b7f.tar.xz |
hashmap: introduce hashmap_free_entries
`hashmap_free_entries' behaves like `container_of' and passes
the offset of the hashmap_entry struct to the internal
`hashmap_free_' function, allowing the function to free any
struct pointer regardless of where the hashmap_entry field
is located.
`hashmap_free' no longer takes any arguments aside from
the hashmap itself.
Signed-off-by: Eric Wong <e@80x24.org>
Reviewed-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/fetch.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index 476c2416e3..09f7170616 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -366,7 +366,7 @@ static void find_non_local_tags(const struct ref *refs, item = refname_hash_add(&remote_refs, ref->name, &ref->old_oid); string_list_insert(&remote_refs_list, ref->name); } - hashmap_free(&existing_refs, 1); + hashmap_free_entries(&existing_refs, struct refname_hash_entry, ent); /* * We may have a final lightweight tag that needs to be @@ -401,7 +401,7 @@ static void find_non_local_tags(const struct ref *refs, **tail = rm; *tail = &rm->next; } - hashmap_free(&remote_refs, 1); + hashmap_free_entries(&remote_refs, struct refname_hash_entry, ent); string_list_clear(&remote_refs_list, 0); } @@ -530,7 +530,7 @@ static struct ref *get_ref_map(struct remote *remote, } } } - hashmap_free(&existing_refs, 1); + hashmap_free_entries(&existing_refs, struct refname_hash_entry, ent); return ref_map; } |