summaryrefslogtreecommitdiff
path: root/blame.c
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-10-06 23:30:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-07 01:20:12 (GMT)
commit404ab78e39fc74c4eb604b6003642ed264f687a6 (patch)
tree54cea276f612f84304b9420257a8a667d02ccbbe /blame.c
parent23dee69f53cf5024ca79e0b707dcb03c63f33bef (diff)
downloadgit-404ab78e39fc74c4eb604b6003642ed264f687a6.zip
git-404ab78e39fc74c4eb604b6003642ed264f687a6.tar.gz
git-404ab78e39fc74c4eb604b6003642ed264f687a6.tar.bz2
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 'blame.c')
-rw-r--r--blame.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/blame.c b/blame.c
index 90b247a..6384f48 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);