git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>
Subject: [PATCH 2/2] submodule-config: don't shadow `cache`
Date: Wed, 27 Apr 2016 14:30:40 -0700	[thread overview]
Message-ID: <1461792640-18898-2-git-send-email-sbeller@google.com> (raw)
In-Reply-To: <1461792640-18898-1-git-send-email-sbeller@google.com>

Lots of internal functions in submodule-confic.c have a first parameter
`struct submodule_cache *cache`, which currently always refers to the
global variable `cache` in the file. To avoid confusion rename the
global `cache` variable.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 submodule-config.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/submodule-config.c b/submodule-config.c
index 8ac5031..debab29 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -30,7 +30,7 @@ enum lookup_type {
 	lookup_path
 };
 
-static struct submodule_cache cache;
+static struct submodule_cache the_submodule_cache;
 static int is_cache_init;
 
 static int config_path_cmp(const struct submodule_entry *a,
@@ -470,14 +470,14 @@ static void ensure_cache_init(void)
 	if (is_cache_init)
 		return;
 
-	cache_init(&cache);
+	cache_init(&the_submodule_cache);
 	is_cache_init = 1;
 }
 
 int parse_submodule_config_option(const char *var, const char *value)
 {
 	struct parse_config_parameter parameter;
-	parameter.cache = &cache;
+	parameter.cache = &the_submodule_cache;
 	parameter.commit_sha1 = NULL;
 	parameter.gitmodules_sha1 = null_sha1;
 	parameter.overwrite = 1;
@@ -490,18 +490,18 @@ const struct submodule *submodule_from_name(const unsigned char *commit_sha1,
 		const char *name)
 {
 	ensure_cache_init();
-	return config_from_name(&cache, commit_sha1, name);
+	return config_from_name(&the_submodule_cache, commit_sha1, name);
 }
 
 const struct submodule *submodule_from_path(const unsigned char *commit_sha1,
 		const char *path)
 {
 	ensure_cache_init();
-	return config_from_path(&cache, commit_sha1, path);
+	return config_from_path(&the_submodule_cache, commit_sha1, path);
 }
 
 void submodule_free(void)
 {
-	cache_free(&cache);
+	cache_free(&the_submodule_cache);
 	is_cache_init = 0;
 }
-- 
2.8.0.41.g0ac0153.dirty

      reply	other threads:[~2016-04-27 21:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 21:30 [PATCH 1/2] config.c: drop local variable Stefan Beller
2016-04-27 21:30 ` Stefan Beller [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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1461792640-18898-2-git-send-email-sbeller@google.com \
    --to=sbeller@google.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).