summaryrefslogtreecommitdiff
path: root/blame.c
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-10-06 23:30:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-07 01:20:11 (GMT)
commitf23a465132a22860684ac66052cf9a954a18e27d (patch)
tree0af87116e641be6cc7f7dc75e1a337e917abc610 /blame.c
parentf0e63c41139f8982add435536d39aff6f3d4ca98 (diff)
downloadgit-f23a465132a22860684ac66052cf9a954a18e27d.zip
git-f23a465132a22860684ac66052cf9a954a18e27d.tar.gz
git-f23a465132a22860684ac66052cf9a954a18e27d.tar.bz2
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.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/blame.c b/blame.c
index 00f8f3f..aa46c7e 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