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:
committed by
Junio C Hamano
parent
d0a48a0a1d
commit
d22245a2e3
4
attr.c
4
attr.c
@ -98,7 +98,7 @@ static void *attr_hashmap_get(struct attr_hashmap *map,
|
||||
if (!map->map.tablesize)
|
||||
attr_hashmap_init(map);
|
||||
|
||||
hashmap_entry_init(&k, memhash(key, keylen));
|
||||
hashmap_entry_init(&k.ent, memhash(key, keylen));
|
||||
k.key = key;
|
||||
k.keylen = keylen;
|
||||
e = hashmap_get(&map->map, &k, NULL);
|
||||
@ -117,7 +117,7 @@ static void attr_hashmap_add(struct attr_hashmap *map,
|
||||
attr_hashmap_init(map);
|
||||
|
||||
e = xmalloc(sizeof(struct attr_hash_entry));
|
||||
hashmap_entry_init(e, memhash(key, keylen));
|
||||
hashmap_entry_init(&e->ent, memhash(key, keylen));
|
||||
e->key = key;
|
||||
e->keylen = keylen;
|
||||
e->value = value;
|
||||
|
||||
Reference in New Issue
Block a user