Skip to content

Commit 152598c

Browse files
mhaggergitster
authored andcommitted
recs_match(): take two xrecord_t pointers as arguments
There is no reason for it to take an array and two indexes as argument, as it only accesses two elements of the array. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c06c0b6 commit 152598c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

xdiff/xdiffi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,11 @@ static int is_blank_line(xrecord_t *rec, long flags)
405405
return xdl_blankline(rec->ptr, rec->size, flags);
406406
}
407407

408-
static int recs_match(xrecord_t **recs, long ixs, long ix, long flags)
408+
static int recs_match(xrecord_t *rec1, xrecord_t *rec2, long flags)
409409
{
410-
return (recs[ixs]->ha == recs[ix]->ha &&
411-
xdl_recmatch(recs[ixs]->ptr, recs[ixs]->size,
412-
recs[ix]->ptr, recs[ix]->size,
410+
return (rec1->ha == rec2->ha &&
411+
xdl_recmatch(rec1->ptr, rec1->size,
412+
rec2->ptr, rec2->size,
413413
flags));
414414
}
415415

@@ -457,7 +457,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
457457
* the last line of the current change group, shift backward
458458
* the group.
459459
*/
460-
while (ixs > 0 && recs_match(recs, ixs - 1, ix - 1, flags)) {
460+
while (ixs > 0 && recs_match(recs[ixs - 1], recs[ix - 1], flags)) {
461461
rchg[--ixs] = 1;
462462
rchg[--ix] = 0;
463463

@@ -484,7 +484,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
484484
* the line next of the current change group, shift forward
485485
* the group.
486486
*/
487-
while (ix < nrec && recs_match(recs, ixs, ix, flags)) {
487+
while (ix < nrec && recs_match(recs[ixs], recs[ix], flags)) {
488488
blank_lines += is_blank_line(recs[ix], flags);
489489

490490
rchg[ixs++] = 0;
@@ -525,7 +525,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
525525
*/
526526
while (ixs > 0 &&
527527
!is_blank_line(recs[ix - 1], flags) &&
528-
recs_match(recs, ixs - 1, ix - 1, flags)) {
528+
recs_match(recs[ixs - 1], recs[ix - 1], flags)) {
529529
rchg[--ixs] = 1;
530530
rchg[--ix] = 0;
531531
while (rchgo[--ixo]);

0 commit comments

Comments
 (0)