git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Jay Soffian <jaysoffian@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <junio@kernel.org>
Subject: [PATCH] add, merge, diff: do not use strcasecmp to compare config variable names
Date: Sat, 14 May 2011 15:19:21 -0500	[thread overview]
Message-ID: <20110514201921.GA10758@elie> (raw)
In-Reply-To: <BANLkTi=MSfRhUhY1jkRC0agQNp7WHDG9FQ@mail.gmail.com>

The config machinery already makes section and variable names
lowercase when parsing them, so using strcasecmp for comparison just
feels wasteful.  No noticeable change intended.

Noticed-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Jay Soffian wrote:
> On Sat, May 14, 2011 at 3:01 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:

>> No need to use strcasecmp --- the vars passed to config functions
>> already have the section and variable names in lowercase.
>
> Okay, it was a cut-and-paste from ignore-errors I think.

Good catch.

 builtin/add.c     |    4 ++--
 merge-recursive.c |    6 +++---
 xdiff-interface.c |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/builtin/add.c b/builtin/add.c
index 704141f..e57abdd 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -331,8 +331,8 @@ static struct option builtin_add_options[] = {
 
 static int add_config(const char *var, const char *value, void *cb)
 {
-	if (!strcasecmp(var, "add.ignoreerrors") ||
-	    !strcasecmp(var, "add.ignore-errors")) {
+	if (!strcmp(var, "add.ignoreerrors") ||
+	    !strcmp(var, "add.ignore-errors")) {
 		ignore_add_errors = git_config_bool(var, value);
 		return 0;
 	}
diff --git a/merge-recursive.c b/merge-recursive.c
index ecb1806..07ad1a3 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1721,15 +1721,15 @@ int merge_recursive_generic(struct merge_options *o,
 static int merge_recursive_config(const char *var, const char *value, void *cb)
 {
 	struct merge_options *o = cb;
-	if (!strcasecmp(var, "merge.verbosity")) {
+	if (!strcmp(var, "merge.verbosity")) {
 		o->verbosity = git_config_int(var, value);
 		return 0;
 	}
-	if (!strcasecmp(var, "diff.renamelimit")) {
+	if (!strcmp(var, "diff.renamelimit")) {
 		o->diff_rename_limit = git_config_int(var, value);
 		return 0;
 	}
-	if (!strcasecmp(var, "merge.renamelimit")) {
+	if (!strcmp(var, "merge.renamelimit")) {
 		o->merge_rename_limit = git_config_int(var, value);
 		return 0;
 	}
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 164581f..0e2c169 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -347,7 +347,7 @@ int git_xmerge_style = -1;
 
 int git_xmerge_config(const char *var, const char *value, void *cb)
 {
-	if (!strcasecmp(var, "merge.conflictstyle")) {
+	if (!strcmp(var, "merge.conflictstyle")) {
 		if (!value)
 			die("'%s' is not a boolean", var);
 		if (!strcmp(value, "diff3"))
-- 
1.7.5.1

  reply	other threads:[~2011-05-14 20:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-14 17:22 [PATCH] Add log.abbrev-commit config option Jay Soffian
2011-05-14 17:26 ` Jay Soffian
2011-05-14 19:01 ` Jonathan Nieder
2011-05-14 19:35   ` Jay Soffian
2011-05-14 20:19     ` Jonathan Nieder [this message]
2011-05-15  1:53       ` [PATCH] add, merge, diff: do not use strcasecmp to compare config variable names Junio C Hamano
2011-05-14 20:47   ` [PATCH v2] Add log.abbrevCommit config variable Jay Soffian
2011-05-14 21:55     ` Jonathan Nieder
2011-05-14 22:22       ` Jay Soffian
2011-05-14 22:49         ` [PATCH v3] " Jay Soffian
2011-05-15 13:25           ` Jay Soffian
2011-05-15 22:42           ` Junio C Hamano
2011-05-16  5:53             ` Jay Soffian
2011-05-16  7:00               ` Jonathan Nieder
2011-05-16  7:18                 ` Jay Soffian
2011-05-17 17:03                 ` Junio C Hamano
2011-05-17 21:50                   ` Junio C Hamano
2011-05-18  1:05                     ` Jay Soffian
2011-05-17 18:50           ` Junio C Hamano
2011-05-17 19:08             ` Jay Soffian
2011-05-15  1:48   ` [PATCH] Add log.abbrev-commit config option Junio C Hamano
2011-05-16  8:24     ` Michael J Gruber

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=20110514201921.GA10758@elie \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jaysoffian@gmail.com \
    --cc=junio@kernel.org \
    /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).