summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-10-06 23:30:34 +0000
committerJunio C Hamano <gitster@pobox.com>2019-10-07 10:20:10 +0900
commit6bcbdfb277bdc81b5ad6996b3fb005382a35c2ee (patch)
treed2c5a170735b75f905cfe0314aec1d6431e6142a /diffcore-rename.c
parent973d5eea7455e1053842f7474c8ec34755f3525b (diff)
downloadgit-6bcbdfb277bdc81b5ad6996b3fb005382a35c2ee.tar.gz
hashmap_get_next returns "struct hashmap_entry *"
This is a step towards removing the requirement for hashmap_entry being the first field of 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 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 4670a40179..71aa240a68 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -274,7 +274,7 @@ static int find_identical_files(struct hashmap *srcs,
struct diff_options *options)
{
int renames = 0;
-
+ struct hashmap_entry *ent;
struct diff_filespec *target = rename_dst[dst_index].two;
struct file_similarity *p, *best = NULL;
int i = 100, best_score = -1;
@@ -282,12 +282,15 @@ static int find_identical_files(struct hashmap *srcs,
/*
* Find the best source match for specified destination.
*/
- p = hashmap_get_from_hash(srcs,
+ ent = hashmap_get_from_hash(srcs,
hash_filespec(options->repo, target),
NULL);
- for (; p; p = hashmap_get_next(srcs, &p->entry)) {
+ for (; ent; ent = hashmap_get_next(srcs, ent)) {
int score;
- struct diff_filespec *source = p->filespec;
+ struct diff_filespec *source;
+
+ p = container_of(ent, struct file_similarity, entry);
+ source = p->filespec;
/* False hash collision? */
if (!oideq(&source->oid, &target->oid))