From: Alex Henrie Date: Tue, 1 Oct 2019 02:29:35 +0000 (-0600) Subject: diffcore-break: use a goto instead of a redundant if statement X-Git-Tag: v2.24.0-rc0~47^2~2 X-Git-Url: http://git.bitbasher.net/?a=commitdiff_plain;h=baed6bbb5b56a501d1137e53caba614f77c3435d;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/diffcore-break.c b/diffcore-break.c index 875aefd3fe..9d20a6a6fc 100644 --- a/diffcore-break.c +++ b/diffcore-break.c @@ -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;