hashmap: remove type arg from hashmap_{get,put,remove}_entry

Since these macros already take a `keyvar' pointer of a known type,
we can rely on OFFSETOF_VAR to get the correct offset without
relying on non-portable `__typeof__' and `offsetof'.

Argument order is also rearranged, so `keyvar' and `member' are
sequential as they are used as: `keyvar->member'

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:42 +00:00
committed by Junio C Hamano
parent 23dee69f53
commit 404ab78e39
17 changed files with 56 additions and 55 deletions

View File

@ -151,8 +151,7 @@ static void paths_and_oids_insert(struct hashmap *map,
key.path = (char *)path;
oidset_init(&key.trees, 0);
entry = hashmap_get_entry(map, &key, NULL,
struct path_and_oids_entry, ent);
entry = hashmap_get_entry(map, &key, ent, NULL);
if (!entry) {
entry = xcalloc(1, sizeof(struct path_and_oids_entry));
hashmap_entry_init(&entry->ent, hash);