basic/env-util: silence two gcc warnings
This commit is contained in:
@@ -515,10 +515,10 @@ char *replace_env_n(const char *format, size_t n, char **env, unsigned flags) {
|
||||
ALTERNATE_VALUE,
|
||||
} state = WORD;
|
||||
|
||||
const char *e, *word = format, *test_value;
|
||||
const char *e, *word = format, *test_value = NULL; /* test_value is initialized to appease gcc */
|
||||
char *k;
|
||||
_cleanup_free_ char *r = NULL;
|
||||
size_t i, len;
|
||||
size_t i, len = 0; /* len is initialized to appease gcc */
|
||||
int nest = 0;
|
||||
|
||||
assert(format);
|
||||
@@ -581,13 +581,12 @@ char *replace_env_n(const char *format, size_t n, char **env, unsigned flags) {
|
||||
word = e+1;
|
||||
state = WORD;
|
||||
} else if (*e == ':') {
|
||||
if (!(flags & REPLACE_ENV_ALLOW_EXTENDED))
|
||||
if (flags & REPLACE_ENV_ALLOW_EXTENDED) {
|
||||
len = e - word - 2;
|
||||
state = TEST;
|
||||
} else
|
||||
/* Treat this as unsupported syntax, i.e. do no replacement */
|
||||
state = WORD;
|
||||
else {
|
||||
len = e-word-2;
|
||||
state = TEST;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user