THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

diffcore-break: use a goto instead of a redundant if statement

The condition "if (q->nr <= j)" checks whether the loop exited normally
or via a break statement. Avoid this check by replacing the jump out of
the inner loop with a jump to the end of the outer loop, which makes it
obvious that diff_q is not executed when the peer survives.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tags/v2.24.0-rc0
Alex Henrie Junio C Hamano 1 month ago
parent
commit
baed6bbb5b
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      diffcore-break.c

+ 6
- 6
diffcore-break.c View File

@@ -286,17 +286,17 @@ void diffcore_merge_broken(void)
/* Peer survived. Merge them */
merge_broken(p, pp, &outq);
q->queue[j] = NULL;
break;
goto next;
}
}
if (q->nr <= j)
/* The peer did not survive, so we keep
* it in the output.
*/
diff_q(&outq, p);
/* The peer did not survive, so we keep
* it in the output.
*/
diff_q(&outq, p);
}
else
diff_q(&outq, p);
next:;
}
free(q->queue);
*q = outq;


Loading…
Cancel
Save