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

[PATCH 3/3] diff.c: simplify diff_opt_break_rewrites()

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jan 22, 2019, 00:26 UTC
Message-ID
<20190122002635.9411-4-pclouds@gmail.com>
In-Reply-To
<20190122002635.9411-1-pclouds@gmail.com>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 diff.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/diff.c b/diff.c
index da5ba835ce..2351571251 100644
--- a/diff.c
+++ b/diff.c
@@ -4814,20 +4814,15 @@ static int diff_opt_break_rewrites(const struct option *opt,
 				   const char *arg, int unset)
 {
 	int *break_opt = opt->value;
-	int opt1, opt2;
+	int opt1, opt2 = 0;
 
 	BUG_ON_OPT_NEG(unset);
 	if (!arg)
 		arg = "";
 	opt1 = parse_rename_score(&arg);
-	switch (*arg) {
-	case '\0':
-		opt2 = 0;
-		break;
-	case '/':
+	if (*arg == '/') {
 		arg++;
 		opt2 = parse_rename_score(&arg);
-		break;
 	}
 	if (*arg != 0)
 		return error(_("%s expects <n>/<m> form"), opt->long_name);
-- 
2.20.1.560.g70ca8b83ee
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 3 of 10 in “nd/diff-parseopt fixups”
  1. 0/3 nd/diff-parseopt fixupsNguyễn Thái Ngọc Duy, Jan 22, 2019
  2. 1/3 Revert "parse-options: allow keep-unknown + stop-at-non-opt combination"Nguyễn Thái Ngọc Duy, Jan 22, 2019
  3. 3/3 diff.c: simplify diff_opt_break_rewrites()Nguyễn Thái Ngọc Duy, Jan 22, 2019
  4. Junio C HamanoJan 22, 2019
  5. Junio C HamanoJan 22, 2019
  6. 2/3 diff.c: delete unused functionsNguyễn Thái Ngọc Duy, Jan 22, 2019
  7. 0/3 nd/diff-parseopt fixupsNguyễn Thái Ngọc Duy, Jan 22, 2019
  8. 1/3 Revert "parse-options: allow keep-unknown + stop-at-non-opt combination"Nguyễn Thái Ngọc Duy, Jan 22, 2019
  9. 2/3 diff.c: delete unused functionsNguyễn Thái Ngọc Duy, Jan 22, 2019
  10. 3/3 diff.c: simplify diff_opt_break_rewrites()Nguyễn Thái Ngọc Duy, Jan 22, 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.