Skip to content

Commit daffa89

Browse files
committed
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
2 parents 65c1891 + f91371b commit daffa89

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

xdiff/xpatience.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map,
9090
{
9191
xrecord_t **records = pass == 1 ?
9292
map->env->xdf1.recs : map->env->xdf2.recs;
93-
xrecord_t *record = records[line - 1], *other;
93+
xrecord_t *record = records[line - 1];
9494
/*
9595
* After xdl_prepare_env() (or more precisely, due to
9696
* 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,
104104
int index = (int)((record->ha << 1) % map->alloc);
105105

106106
while (map->entries[index].line1) {
107-
other = map->env->xdf1.recs[map->entries[index].line1 - 1];
108-
if (map->entries[index].hash != record->ha ||
109-
!xdl_recmatch(record->ptr, record->size,
110-
other->ptr, other->size,
111-
map->xpp->flags)) {
107+
if (map->entries[index].hash != record->ha) {
112108
if (++index >= map->alloc)
113109
index = 0;
114110
continue;
@@ -253,8 +249,7 @@ static int match(struct hashmap *map, int line1, int line2)
253249
{
254250
xrecord_t *record1 = map->env->xdf1.recs[line1 - 1];
255251
xrecord_t *record2 = map->env->xdf2.recs[line2 - 1];
256-
return xdl_recmatch(record1->ptr, record1->size,
257-
record2->ptr, record2->size, map->xpp->flags);
252+
return record1->ha == record2->ha;
258253
}
259254

260255
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,
289284

290285
/* Recurse */
291286
if (next1 > line1 || next2 > line2) {
292-
struct hashmap submap;
293-
294-
memset(&submap, 0, sizeof(submap));
295287
if (patience_diff(map->file1, map->file2,
296288
map->xpp, map->env,
297289
line1, next1 - line1,

0 commit comments

Comments
 (0)