Skip to content

Commit 77c188e

Browse files
phillipwoodgitster
authored andcommitted
xdiff: cleanup xdl_clean_mmatch()
Remove the "s" parameter as, since the last commit, this function is always called with s == 0. Also change parameter "e" to expect a length, rather than the index of the last line to simplify the caller. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9232a7a commit 77c188e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

xdiff/xprepare.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ void xdl_free_env(xdfenv_t *xe) {
197197
}
198198

199199

200-
static bool xdl_clean_mmatch(uint8_t const *action, ptrdiff_t i, ptrdiff_t s, ptrdiff_t e) {
200+
static bool xdl_clean_mmatch(uint8_t const *action, ptrdiff_t i, ptrdiff_t len) {
201201
ptrdiff_t r, rdis0, rpdis0, rdis1, rpdis1;
202+
ptrdiff_t s = 0, e = len - 1;
202203

203204
/*
204205
* Limits the window that is examined during the similar-lines
@@ -333,7 +334,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd
333334
xdf1->nreff = 0;
334335
for (i = 0; i < len1; i++) {
335336
if (action1[i] == KEEP ||
336-
(action1[i] == INVESTIGATE && !xdl_clean_mmatch(action1, i, 0, len1 - 1))) {
337+
(action1[i] == INVESTIGATE && !xdl_clean_mmatch(action1, i, len1))) {
337338
xdf1->reference_index[xdf1->nreff++] = i + off;
338339
/* changed[i] remains false, i.e. keep */
339340
} else {
@@ -345,7 +346,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd
345346
xdf2->nreff = 0;
346347
for (i = 0; i < len2; i++) {
347348
if (action2[i] == KEEP ||
348-
(action2[i] == INVESTIGATE && !xdl_clean_mmatch(action2, i, 0, len2 - 1))) {
349+
(action2[i] == INVESTIGATE && !xdl_clean_mmatch(action2, i, len2))) {
349350
xdf2->reference_index[xdf2->nreff++] = i + off;
350351
/* changed[i] remains false, i.e. keep */
351352
} else {

0 commit comments

Comments
 (0)