Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Henrie <alexhenrie24@gmail.com>2019-10-01 05:29:35 +0300
committerJunio C Hamano <gitster@pobox.com>2019-10-02 09:04:21 +0300
commitbaed6bbb5b56a501d1137e53caba614f77c3435d (patch)
treefd27f129a90d4221fd8f36ca5d8883db43ebc54d /diffcore-break.c
parent8da02ce62a4e76aea7a02d56b66b10eedc8e6db8 (diff)
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>
Diffstat (limited to 'diffcore-break.c')
-rw-r--r--diffcore-break.c12
1 files changed, 6 insertions, 6 deletions
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;