diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-05-14 01:26:07 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-05-14 01:26:08 +0200 |
commit | daffa8961bdd19c5aa66849d801162ef47432826 (patch) | |
tree | f26aa84293ba184bc7e4518d45fce3abccbb0125 /xdiff | |
parent | Merge branch 'pw/word-diff-zero-width-matches' (diff) | |
parent | patience diff: remove unused variable (diff) | |
download | git-daffa8961bdd19c5aa66849d801162ef47432826.tar.xz git-daffa8961bdd19c5aa66849d801162ef47432826.zip |
Merge branch 'pw/patience-diff-clean-up'
Code clean-up.
* pw/patience-diff-clean-up:
patience diff: remove unused variable
patience diff: remove unnecessary string comparisons
Diffstat (limited to 'xdiff')
-rw-r--r-- | xdiff/xpatience.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/xdiff/xpatience.c b/xdiff/xpatience.c index 20699a6f60..c5d48e80ae 100644 --- a/xdiff/xpatience.c +++ b/xdiff/xpatience.c @@ -90,7 +90,7 @@ static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map, { xrecord_t **records = pass == 1 ? map->env->xdf1.recs : map->env->xdf2.recs; - xrecord_t *record = records[line - 1], *other; + xrecord_t *record = records[line - 1]; /* * After xdl_prepare_env() (or more precisely, due to * xdl_classify_record()), the "ha" member of the records (AKA lines) @@ -104,11 +104,7 @@ static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map, int index = (int)((record->ha << 1) % map->alloc); while (map->entries[index].line1) { - other = map->env->xdf1.recs[map->entries[index].line1 - 1]; - if (map->entries[index].hash != record->ha || - !xdl_recmatch(record->ptr, record->size, - other->ptr, other->size, - map->xpp->flags)) { + if (map->entries[index].hash != record->ha) { if (++index >= map->alloc) index = 0; continue; @@ -253,8 +249,7 @@ static int match(struct hashmap *map, int line1, int line2) { xrecord_t *record1 = map->env->xdf1.recs[line1 - 1]; xrecord_t *record2 = map->env->xdf2.recs[line2 - 1]; - return xdl_recmatch(record1->ptr, record1->size, - record2->ptr, record2->size, map->xpp->flags); + return record1->ha == record2->ha; } static int patience_diff(mmfile_t *file1, mmfile_t *file2, @@ -289,9 +284,6 @@ static int walk_common_sequence(struct hashmap *map, struct entry *first, /* Recurse */ if (next1 > line1 || next2 > line2) { - struct hashmap submap; - - memset(&submap, 0, sizeof(submap)); if (patience_diff(map->file1, map->file2, map->xpp, map->env, line1, next1 - line1, |