summaryrefslogtreecommitdiff
path: root/range-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-10-15 04:48:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-15 04:48:02 (GMT)
commit5efabc7ed9e57bb73159d1ad7739c508167ef24a (patch)
tree9e7de3dfe38dcb92614d11613976d32151925ea2 /range-diff.c
parentd0ce4d9024882b5363141288979ea3689eab9998 (diff)
parente2b5038d8793a1d1f92b62dab82acc0d6b7dbcb7 (diff)
downloadgit-5efabc7ed9e57bb73159d1ad7739c508167ef24a.zip
git-5efabc7ed9e57bb73159d1ad7739c508167ef24a.tar.gz
git-5efabc7ed9e57bb73159d1ad7739c508167ef24a.tar.bz2
Merge branch 'ew/hashmap'
Code clean-up of the hashmap API, both users and implementation. * ew/hashmap: hashmap_entry: remove first member requirement from docs hashmap: remove type arg from hashmap_{get,put,remove}_entry OFFSETOF_VAR macro to simplify hashmap iterators hashmap: introduce hashmap_free_entries hashmap: hashmap_{put,remove} return hashmap_entry * hashmap: use *_entry APIs for iteration hashmap_cmp_fn takes hashmap_entry params hashmap_get{,_from_hash} return "struct hashmap_entry *" hashmap: use *_entry APIs to wrap container_of hashmap_get_next returns "struct hashmap_entry *" introduce container_of macro hashmap_put takes "struct hashmap_entry *" hashmap_remove takes "const struct hashmap_entry *" hashmap_get takes "const struct hashmap_entry *" hashmap_add takes "struct hashmap_entry *" hashmap_get_next takes "const struct hashmap_entry *" hashmap_entry_init takes "struct hashmap_entry *" packfile: use hashmap_entry in delta_base_cache_entry coccicheck: detect hashmap_entry.hash assignment diff: use hashmap_entry_init on moved_entry.ent
Diffstat (limited to 'range-diff.c')
-rw-r--r--range-diff.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/range-diff.c b/range-diff.c
index f2fc1e0..7fed5a3 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -218,8 +218,8 @@ static void find_exact_matches(struct string_list *a, struct string_list *b)
util->i = i;
util->patch = a->items[i].string;
util->diff = util->patch + util->diff_offset;
- hashmap_entry_init(util, strhash(util->diff));
- hashmap_add(&map, util);
+ hashmap_entry_init(&util->e, strhash(util->diff));
+ hashmap_add(&map, &util->e);
}
/* Now try to find exact matches in b */
@@ -229,8 +229,8 @@ static void find_exact_matches(struct string_list *a, struct string_list *b)
util->i = i;
util->patch = b->items[i].string;
util->diff = util->patch + util->diff_offset;
- hashmap_entry_init(util, strhash(util->diff));
- other = hashmap_remove(&map, util, NULL);
+ hashmap_entry_init(&util->e, strhash(util->diff));
+ other = hashmap_remove_entry(&map, util, e, NULL);
if (other) {
if (other->matching >= 0)
BUG("already assigned!");
@@ -240,7 +240,7 @@ static void find_exact_matches(struct string_list *a, struct string_list *b)
}
}
- hashmap_free(&map, 0);
+ hashmap_free(&map);
}
static void diffsize_consume(void *data, char *line, unsigned long len)