hashmap_put takes "struct hashmap_entry *"
This is less error-prone than "void *" as the compiler now detects invalid types being passed. Signed-off-by: Eric Wong <e@80x24.org> Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
28ee794128
commit
26b455f21e
5
refs.c
5
refs.c
@ -1863,10 +1863,13 @@ static void register_ref_store_map(struct hashmap *map,
|
||||
struct ref_store *refs,
|
||||
const char *name)
|
||||
{
|
||||
struct ref_store_hash_entry *entry;
|
||||
|
||||
if (!map->tablesize)
|
||||
hashmap_init(map, ref_store_hash_cmp, NULL, 0);
|
||||
|
||||
if (hashmap_put(map, alloc_ref_store_hash_entry(name, refs)))
|
||||
entry = alloc_ref_store_hash_entry(name, refs);
|
||||
if (hashmap_put(map, &entry->ent))
|
||||
BUG("%s ref_store '%s' initialized twice", type, name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user