hashmap_entry_init takes "struct hashmap_entry *"

C compilers do type checking to make life easier for us.  So
rely on that and update all hashmap_entry_init callers to take
"struct hashmap_entry *" to avoid future bugs while improving
safety and readability.

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:
Eric Wong
2019-10-06 23:30:27 +00:00
committed by Junio C Hamano
parent d0a48a0a1d
commit d22245a2e3
23 changed files with 55 additions and 52 deletions

View File

@ -293,13 +293,13 @@ const void *memintern(const void *data, size_t len)
hashmap_init(&map, (hashmap_cmp_fn) pool_entry_cmp, NULL, 0);
/* lookup interned string in pool */
hashmap_entry_init(&key, memhash(data, len));
hashmap_entry_init(&key.ent, memhash(data, len));
key.len = len;
e = hashmap_get(&map, &key, data);
if (!e) {
/* not found: create it */
FLEX_ALLOC_MEM(e, data, data, len);
hashmap_entry_init(e, key.ent.hash);
hashmap_entry_init(&e->ent, key.ent.hash);
e->len = len;
hashmap_add(&map, e);
}