From 404ab78e39fc74c4eb604b6003642ed264f687a6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Oct 2019 23:30:42 +0000 Subject: 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 Reviewed-by: Derrick Stolee Signed-off-by: Junio C Hamano --- blame.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'blame.c') diff --git a/blame.c b/blame.c index 90b247abf9..6384f48133 100644 --- a/blame.c +++ b/blame.c @@ -419,8 +419,8 @@ static void get_fingerprint(struct fingerprint *result, continue; hashmap_entry_init(&entry->entry, hash); - found_entry = hashmap_get_entry(&result->map, entry, NULL, - struct fingerprint_entry, entry); + found_entry = hashmap_get_entry(&result->map, entry, + /* member name */ entry, NULL); if (found_entry) { found_entry->count += 1; } else { @@ -452,8 +452,7 @@ static int fingerprint_similarity(struct fingerprint *a, struct fingerprint *b) hashmap_for_each_entry(&b->map, &iter, entry_b, entry /* member name */) { - entry_a = hashmap_get_entry(&a->map, entry_b, NULL, - struct fingerprint_entry, entry); + entry_a = hashmap_get_entry(&a->map, entry_b, entry, NULL); if (entry_a) { intersection += entry_a->count < entry_b->count ? entry_a->count : entry_b->count; @@ -474,8 +473,7 @@ static void fingerprint_subtract(struct fingerprint *a, struct fingerprint *b) hashmap_for_each_entry(&b->map, &iter, entry_b, entry /* member name */) { - entry_a = hashmap_get_entry(&a->map, entry_b, NULL, - struct fingerprint_entry, entry); + entry_a = hashmap_get_entry(&a->map, entry_b, entry, NULL); if (entry_a) { if (entry_a->count <= entry_b->count) hashmap_remove(&a->map, &entry_b->entry, NULL); -- cgit v1.2.3