Skip to content

Commit 934908a

Browse files
committed
Merge branch 'sb/misc-cleanups'
* sb/misc-cleanups: submodule-config: don't shadow `cache` config.c: drop local variable
2 parents 54c2af5 + 99dab16 commit 934908a

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

config.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,14 +1309,11 @@ static struct config_set_element *configset_find_element(struct config_set *cs,
13091309
struct config_set_element k;
13101310
struct config_set_element *found_entry;
13111311
char *normalized_key;
1312-
int ret;
13131312
/*
13141313
* `key` may come from the user, so normalize it before using it
13151314
* for querying entries from the hashmap.
13161315
*/
1317-
ret = git_config_parse_key(key, &normalized_key, NULL);
1318-
1319-
if (ret)
1316+
if (git_config_parse_key(key, &normalized_key, NULL))
13201317
return NULL;
13211318

13221319
hashmap_entry_init(&k, strhash(normalized_key));

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,
@@ -470,14 +470,14 @@ static void ensure_cache_init(void)
470470
if (is_cache_init)
471471
return;
472472

473-
cache_init(&cache);
473+
cache_init(&the_submodule_cache);
474474
is_cache_init = 1;
475475
}
476476

477477
int parse_submodule_config_option(const char *var, const char *value)
478478
{
479479
struct parse_config_parameter parameter;
480-
parameter.cache = &cache;
480+
parameter.cache = &the_submodule_cache;
481481
parameter.commit_sha1 = NULL;
482482
parameter.gitmodules_sha1 = null_sha1;
483483
parameter.overwrite = 1;
@@ -490,18 +490,18 @@ const struct submodule *submodule_from_name(const unsigned char *commit_sha1,
490490
const char *name)
491491
{
492492
ensure_cache_init();
493-
return config_from_name(&cache, commit_sha1, name);
493+
return config_from_name(&the_submodule_cache, commit_sha1, name);
494494
}
495495

496496
const struct submodule *submodule_from_path(const unsigned char *commit_sha1,
497497
const char *path)
498498
{
499499
ensure_cache_init();
500-
return config_from_path(&cache, commit_sha1, path);
500+
return config_from_path(&the_submodule_cache, commit_sha1, path);
501501
}
502502

503503
void submodule_free(void)
504504
{
505-
cache_free(&cache);
505+
cache_free(&the_submodule_cache);
506506
is_cache_init = 0;
507507
}

0 commit comments

Comments
 (0)