From f23a465132a22860684ac66052cf9a954a18e27d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Oct 2019 23:30:36 +0000 Subject: hashmap_get{,_from_hash} return "struct hashmap_entry *" Update callers to use hashmap_get_entry, hashmap_get_entry_from_hash or container_of as appropriate. This is another step towards eliminating the requirement of hashmap_entry being the first field in a struct. Signed-off-by: Eric Wong Reviewed-by: Derrick Stolee Signed-off-by: Junio C Hamano --- blame.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'blame.c') diff --git a/blame.c b/blame.c index 00f8f3fb0a..aa46c7ec52 100644 --- a/blame.c +++ b/blame.c @@ -419,7 +419,8 @@ static void get_fingerprint(struct fingerprint *result, continue; hashmap_entry_init(&entry->entry, hash); - found_entry = hashmap_get(&result->map, &entry->entry, NULL); + found_entry = hashmap_get_entry(&result->map, entry, NULL, + struct fingerprint_entry, entry); if (found_entry) { found_entry->count += 1; } else { @@ -452,7 +453,9 @@ static int fingerprint_similarity(struct fingerprint *a, struct fingerprint *b) hashmap_iter_init(&b->map, &iter); while ((entry_b = hashmap_iter_next(&iter))) { - if ((entry_a = hashmap_get(&a->map, &entry_b->entry, NULL))) { + entry_a = hashmap_get_entry(&a->map, entry_b, NULL, + struct fingerprint_entry, entry); + if (entry_a) { intersection += entry_a->count < entry_b->count ? entry_a->count : entry_b->count; } @@ -471,7 +474,9 @@ static void fingerprint_subtract(struct fingerprint *a, struct fingerprint *b) hashmap_iter_init(&b->map, &iter); while ((entry_b = hashmap_iter_next(&iter))) { - if ((entry_a = hashmap_get(&a->map, &entry_b->entry, NULL))) { + entry_a = hashmap_get_entry(&a->map, entry_b, NULL, + struct fingerprint_entry, entry); + if (entry_a) { if (entry_a->count <= entry_b->count) hashmap_remove(&a->map, &entry_b->entry, NULL); else -- cgit v1.2.3