git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Govind Salinas" <blix@sophiasuchtig.com>
To: "Git Mailing List" <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH] remote.c: guard config parser from value=NULL
Date: Fri, 8 Feb 2008 18:38:19 -0600	[thread overview]
Message-ID: <5d46db230802081638u415871e4i6fc67a98d5ccf0b3@mail.gmail.com> (raw)

Note:Moved multiple checks for null to one place at the top of the function.
Comment in this section conflicted with Junio's request to remove this
behavior.

Signed-off-by: Govind Salinas <blix@sophiasuchtig.com>
---
 remote.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/remote.c b/remote.c
index 0e00680..27cdaa7 100644
--- a/remote.c
+++ b/remote.c
@@ -217,13 +217,13 @@ static int handle_config(const char *key, const
char *value)
 	const char *subkey;
 	struct remote *remote;
 	struct branch *branch;
+	if (!value)
+		return 0;
 	if (!prefixcmp(key, "branch.")) {
 		name = key + 7;
 		subkey = strrchr(name, '.');
 		if (!subkey)
 			return 0;
-		if (!value)
-			return 0;
 		branch = make_branch(name, subkey - name);
 		if (!strcmp(subkey, ".remote")) {
 			branch->remote_name = xstrdup(value);
@@ -244,21 +244,6 @@ static int handle_config(const char *key, const
char *value)
 		return 0;
 	}
 	remote = make_remote(name, subkey - name);
-	if (!value) {
-		/* if we ever have a boolean variable, e.g. "remote.*.disabled"
-		 * [remote "frotz"]
-		 *      disabled
-		 * is a valid way to set it to true; we get NULL in value so
-		 * we need to handle it here.
-		 *
-		 * if (!strcmp(subkey, ".disabled")) {
-		 *      val = git_config_bool(key, value);
-		 *      return 0;
-		 * } else
-		 *
-		 */
-		return 0; /* ignore unknown booleans */
-	}
 	if (!strcmp(subkey, ".url")) {
 		add_url(remote, xstrdup(value));
 	} else if (!strcmp(subkey, ".push")) {
-- 
1.5.4.36.g9af61

             reply	other threads:[~2008-02-09  0:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-09  0:38 Govind Salinas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-02-08  6:43 [Janitors] value could be NULL in config parser Junio C Hamano
2008-02-08 14:26 ` [PATCH] remote.c: guard config parser from value=NULL Miklos Vajna
2008-02-08 16:34   ` Michele Ballabio

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=5d46db230802081638u415871e4i6fc67a98d5ccf0b3@mail.gmail.com \
    --to=blix@sophiasuchtig.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).