diff options
author | Eric Wong <e@80x24.org> | 2019-10-07 02:30:36 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-07 04:20:11 +0300 |
commit | f23a465132a22860684ac66052cf9a954a18e27d (patch) | |
tree | 0af87116e641be6cc7f7dc75e1a337e917abc610 /blame.c | |
parent | f0e63c41139f8982add435536d39aff6f3d4ca98 (diff) |
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 <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.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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 |