From: Christian Couder <chriscool@tuxfamily.org>
To: git@vger.kernel.org
Cc: Junio Hamano <junkio@cox.net>,
Pierre Habouzit <madcoder@debian.org>,
Martin Koegler <mkoegler@auto.tuwien.ac.at>,
Johannes Sixt <j.sixt@viscovery.net>
Subject: [PATCH 1/6] diff.c: remove useless check for value != NULL
Date: Sat, 16 Feb 2008 05:59:53 +0100 [thread overview]
Message-ID: <20080216055953.d5fafe10.chriscool@tuxfamily.org> (raw)
It is not necessary to check if value != NULL before calling
'parse_lldiff_command' as there is already a check inside this
function.
By the way this patch also improves the existing check inside
'parse_lldiff_command' by using:
return config_error_nonbool(var);
instead of:
return error("%s: lacks value", var);
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
diff.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
This patch series can be applied on "master"
on top of my "diff.c: strdup -> xstrdup" patch.
The first 3 patches apply cleanly on "next" though.
diff --git a/diff.c b/diff.c
index e5db293..5640cbf 100644
--- a/diff.c
+++ b/diff.c
@@ -87,7 +87,7 @@ static int parse_lldiff_command(const char *var, const char *ep, const char *val
}
if (!value)
- return error("%s: lacks value", var);
+ return config_error_nonbool(var);
drv->cmd = xstrdup(value);
return 0;
}
@@ -166,13 +166,8 @@ int git_diff_ui_config(const char *var, const char *value)
if (!prefixcmp(var, "diff.")) {
const char *ep = strrchr(var, '.');
- if (ep != var + 4) {
- if (!strcmp(ep, ".command")) {
- if (!value)
- return config_error_nonbool(var);
- return parse_lldiff_command(var, ep, value);
- }
- }
+ if (ep != var + 4 && !strcmp(ep, ".command"))
+ return parse_lldiff_command(var, ep, value);
}
return git_diff_basic_config(var, value);
--
1.5.4.1.129.gf12af-dirty
next reply other threads:[~2008-02-16 4:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-16 4:59 Christian Couder [this message]
2008-02-16 7:14 ` [PATCH 1/6] diff.c: remove useless check for value != NULL Junio C Hamano
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=20080216055953.d5fafe10.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=junkio@cox.net \
--cc=madcoder@debian.org \
--cc=mkoegler@auto.tuwien.ac.at \
/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).