git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Stefan Beller" <sbeller@google.com>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH v2 3/3] diff.c: simplify diff_opt_break_rewrites()
Date: Tue, 22 Jan 2019 07:30:20 +0700	[thread overview]
Message-ID: <20190122003020.9672-4-pclouds@gmail.com> (raw)
In-Reply-To: <20190122003020.9672-1-pclouds@gmail.com>

Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 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


      parent reply	other threads:[~2019-01-22  0:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22  0:26 [PATCH 0/3] nd/diff-parseopt fixups Nguyễn Thái Ngọc Duy
2019-01-22  0:26 ` [PATCH 1/3] Revert "parse-options: allow keep-unknown + stop-at-non-opt combination" Nguyễn Thái Ngọc Duy
2019-01-22  0:26 ` [PATCH 2/3] diff.c: delete unused functions Nguyễn Thái Ngọc Duy
2019-01-22  0:26 ` [PATCH 3/3] diff.c: simplify diff_opt_break_rewrites() Nguyễn Thái Ngọc Duy
2019-01-22 20:50   ` Junio C Hamano
2019-01-22 23:18     ` Junio C Hamano
2019-01-22  0:30 ` [PATCH v2 0/3] nd/diff-parseopt fixups Nguyễn Thái Ngọc Duy
2019-01-22  0:30   ` [PATCH v2 1/3] Revert "parse-options: allow keep-unknown + stop-at-non-opt combination" Nguyễn Thái Ngọc Duy
2019-01-22  0:30   ` [PATCH v2 2/3] diff.c: delete unused functions Nguyễn Thái Ngọc Duy
2019-01-22  0:30   ` Nguyễn Thái Ngọc Duy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190122003020.9672-4-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sbeller@google.com \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).