submodule-config: don't shadow `cache`
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Apr 27, 2016 at 14:30 UTC
99dab16863c2eca584a84bdde748b9c113717603
1 file changed
+6
-6
submodule-config.c
+6
-6
@@ -30,7 +30,7 @@ enum lookup_type {
30
lookup_path
31
};
32
33
-static struct submodule_cache cache;
33
+static struct submodule_cache the_submodule_cache;
34
static int is_cache_init;
35
36
static int config_path_cmp(const struct submodule_entry *a,
@@ -458,14 +458,14 @@ static void ensure_cache_init(void)
458
if (is_cache_init)
459
return;
460
461
- cache_init(&cache);
461
+ cache_init(&the_submodule_cache);
462
is_cache_init = 1;
463
}
464
465
int parse_submodule_config_option(const char *var, const char *value)
466
{
467
struct parse_config_parameter parameter;
468
- parameter.cache = &cache;
468
+ parameter.cache = &the_submodule_cache;
469
parameter.commit_sha1 = NULL;
470
parameter.gitmodules_sha1 = null_sha1;
471
parameter.overwrite = 1;
@@ -478,18 +478,18 @@ const struct submodule *submodule_from_name(const unsigned char *commit_sha1,
478
const char *name)
479
{
480
ensure_cache_init();
481
- return config_from_name(&cache, commit_sha1, name);
481
+ return config_from_name(&the_submodule_cache, commit_sha1, name);
482
}
483
484
const struct submodule *submodule_from_path(const unsigned char *commit_sha1,
485
const char *path)
486
{
487
ensure_cache_init();
488
- return config_from_path(&cache, commit_sha1, path);
488
+ return config_from_path(&the_submodule_cache, commit_sha1, path);
489
}
490
491
void submodule_free(void)
492
{
493
- cache_free(&cache);
493
+ cache_free(&the_submodule_cache);
494
is_cache_init = 0;
495
}