diff options
author | Eric Wong <e@80x24.org> | 2019-10-06 23:30:42 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-07 10:20:12 +0900 |
commit | 404ab78e39fc74c4eb604b6003642ed264f687a6 (patch) | |
tree | 54cea276f612f84304b9420257a8a667d02ccbbe /t | |
parent | OFFSETOF_VAR macro to simplify hashmap iterators (diff) | |
download | tgif-404ab78e39fc74c4eb604b6003642ed264f687a6.tar.xz |
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>
Diffstat (limited to 't')
-rw-r--r-- | t/helper/test-hashmap.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c index f89d1194ef..cc577c8956 100644 --- a/t/helper/test-hashmap.c +++ b/t/helper/test-hashmap.c @@ -189,9 +189,7 @@ int cmd__hashmap(int argc, const char **argv) entry = alloc_test_entry(hash, p1, p2); /* add / replace entry */ - entry = hashmap_put_entry(&map, entry, - struct test_entry, - ent /* member name */); + entry = hashmap_put_entry(&map, entry, ent); /* print and free replaced entry, if any */ puts(entry ? get_value(entry) : "NULL"); |