git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] diffcore-break: use a goto instead of a redundant if statement

From
Alex Henrie <alexhenrie24@gmail.com>
Date
Sep 25, 2019, 02:01 UTC
Message-ID
<20190925020158.751492-3-alexhenrie24@gmail.com>
In-Reply-To
<20190925020158.751492-1-alexhenrie24@gmail.com>
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
 diffcore-break.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/diffcore-break.c b/diffcore-break.c
index 875aefd3fe..f6ab74141b 100644
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -286,18 +286,17 @@ void diffcore_merge_broken(void)
 					/* Peer survived.  Merge them */
 					merge_broken(p, pp, &outq);
 					q->queue[j] = NULL;
-					break;
+					goto done;
 				}
 			}
-			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.
+			 */
 		}
-		else
-			diff_q(&outq, p);
+		diff_q(&outq, p);
 	}
+
+done:
 	free(q->queue);
 	*q = outq;
 
-- 
2.23.0
Previous: Alex HenrieNext: Derrick Stolee
Message 5 of 13 in “scan-build fixes”
  1. 0/3 scan-build fixesAlex Henrie, Sep 25, 2019
  2. 1/3 commit-graph: remove a duplicate assignmentAlex Henrie, Sep 25, 2019
  3. Derrick StoleeSep 26, 2019
  4. Alex HenrieSep 26, 2019
  5. 2/3 diffcore-break: use a goto instead of a redundant if statementAlex Henrie, Sep 25, 2019
  6. Derrick StoleeSep 26, 2019
  7. 3/3 wrapper: use a loop instead of repetitive statementsAlex Henrie, Sep 25, 2019
  8. Derrick StoleeSep 26, 2019
  9. Johannes SchindelinSep 26, 2019
  10. Jeff KingSep 27, 2019
  11. Alex HenrieSep 29, 2019
  12. Jeff KingSep 27, 2019
  13. Derrick StoleeSep 27, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.