Skip to content

Commit 99dab16

Browse files
stefanbellergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 270cd9e commit 99dab16

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

submodule-config.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ enum lookup_type {
3030
lookup_path
3131
};
3232

33-
static struct submodule_cache cache;
33+
static struct submodule_cache the_submodule_cache;
3434
static int is_cache_init;
3535

3636
static int config_path_cmp(const struct submodule_entry *a,
@@ -458,14 +458,14 @@ static void ensure_cache_init(void)
458458
if (is_cache_init)
459459
return;
460460

461-
cache_init(&cache);
461+
cache_init(&the_submodule_cache);
462462
is_cache_init = 1;
463463
}
464464

465465
int parse_submodule_config_option(const char *var, const char *value)
466466
{
467467
struct parse_config_parameter parameter;
468-
parameter.cache = &cache;
468+
parameter.cache = &the_submodule_cache;
469469
parameter.commit_sha1 = NULL;
470470
parameter.gitmodules_sha1 = null_sha1;
471471
parameter.overwrite = 1;
@@ -478,18 +478,18 @@ const struct submodule *submodule_from_name(const unsigned char *commit_sha1,
478478
const char *name)
479479
{
480480
ensure_cache_init();
481-
return config_from_name(&cache, commit_sha1, name);
481+
return config_from_name(&the_submodule_cache, commit_sha1, name);
482482
}
483483

484484
const struct submodule *submodule_from_path(const unsigned char *commit_sha1,
485485
const char *path)
486486
{
487487
ensure_cache_init();
488-
return config_from_path(&cache, commit_sha1, path);
488+
return config_from_path(&the_submodule_cache, commit_sha1, path);
489489
}
490490

491491
void submodule_free(void)
492492
{
493-
cache_free(&cache);
493+
cache_free(&the_submodule_cache);
494494
is_cache_init = 0;
495495
}

0 commit comments

Comments
 (0)