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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Aug 22, 2016 at 13:22 UTC 152598cbb667471c8f5be16e199922a41452b2d5
1 file changed +7 -7
xdiff/xdiffi.c
+7 -7
@@ -405,11 +405,11 @@ static int is_blank_line(xrecord_t *rec, long flags)
405 return xdl_blankline(rec->ptr, rec->size, flags);
406 }
407
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)
409 {
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,
413 flags));
414 }
415
@@ -457,7 +457,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
457 * the last line of the current change group, shift backward
458 * the group.
459 */
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)) {
461 rchg[--ixs] = 1;
462 rchg[--ix] = 0;
463
@@ -484,7 +484,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
484 * the line next of the current change group, shift forward
485 * the group.
486 */
487 - while (ix < nrec && recs_match(recs, ixs, ix, flags)) {
487 + while (ix < nrec && recs_match(recs[ixs], recs[ix], flags)) {
488 blank_lines += is_blank_line(recs[ix], flags);
489
490 rchg[ixs++] = 0;
@@ -525,7 +525,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
525 */
526 while (ixs > 0 &&
527 !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)) {
529 rchg[--ixs] = 1;
530 rchg[--ix] = 0;
531 while (rchgo[--ixo]);