return true;
}
-static int env_append(char **r, char ***k, char **a) {
- assert(r);
+static int env_append(char **e, char ***k, char **a) {
+ assert(e);
assert(k);
- assert(*k >= r);
+ assert(*k >= e);
if (!a)
return 0;
- /* Expects the following arguments: 'r' shall point to the beginning of an strv we are going to append to, 'k'
+ /* Expects the following arguments: 'e' shall point to the beginning of an strv we are going to append to, 'k'
* to a pointer pointing to the NULL entry at the end of the same array. 'a' shall point to another strv.
*
- * This call adds every entry of 'a' to 'r', either overriding an existing matching entry, or appending to it.
+ * This call adds every entry of 'a' to 'e', either overriding an existing matching entry, or appending to it.
*
- * This call assumes 'r' has enough pre-allocated space to grow by all of 'a''s items. */
+ * This call assumes 'e' has enough pre-allocated space to grow by all of 'a''s items. */
for (; *a; a++) {
char **j, *c;
if ((*a)[n] == '=')
n++;
- for (j = r; j < *k; j++)
+ for (j = e; j < *k; j++)
if (strneq(*j, *a, n))
break;
char **strv_env_delete(char **x, size_t n_lists, ...) {
size_t n, i = 0;
- _cleanup_strv_free_ char **r = NULL;
+ _cleanup_strv_free_ char **t = NULL;
va_list ap;
/* Deletes every entry from x that is mentioned in the other
n = strv_length(x);
- r = new(char*, n+1);
- if (!r)
+ t = new(char*, n+1);
+ if (!t)
return NULL;
STRV_FOREACH(k, x) {
}
va_end(ap);
- r[i] = strdup(*k);
- if (!r[i])
+ t[i] = strdup(*k);
+ if (!t[i])
return NULL;
i++;
va_end(ap);
}
- r[i] = NULL;
+ t[i] = NULL;
assert(i <= n);
- return TAKE_PTR(r);
+ return TAKE_PTR(t);
}
char **strv_env_unset(char **l, const char *p) {
const char *e, *word = format, *test_value = NULL; /* test_value is initialized to appease gcc */
char *k;
- _cleanup_free_ char *r = NULL;
+ _cleanup_free_ char *s = NULL;
size_t i, len = 0; /* len is initialized to appease gcc */
int nest = 0;
case CURLY:
if (*e == '{') {
- k = strnappend(r, word, e-word-1);
+ k = strnappend(s, word, e-word-1);
if (!k)
return NULL;
- free_and_replace(r, k);
+ free_and_replace(s, k);
word = e-1;
state = VARIABLE;
nest++;
} else if (*e == '$') {
- k = strnappend(r, word, e-word);
+ k = strnappend(s, word, e-word);
if (!k)
return NULL;
- free_and_replace(r, k);
+ free_and_replace(s, k);
word = e+1;
state = WORD;
} else if (flags & REPLACE_ENV_ALLOW_BRACELESS && strchr(VALID_BASH_ENV_NAME_CHARS, *e)) {
- k = strnappend(r, word, e-word-1);
+ k = strnappend(s, word, e-word-1);
if (!k)
return NULL;
- free_and_replace(r, k);
+ free_and_replace(s, k);
word = e-1;
state = VARIABLE_RAW;
t = strv_env_get_n(env, word+2, e-word-2, flags);
- if (!strextend(&r, t))
+ if (!strextend(&s, t))
return NULL;
word = e+1;
else if (!t && state == DEFAULT_VALUE)
t = v = replace_env_n(test_value, e-test_value, env, flags);
- if (!strextend(&r, t))
+ if (!strextend(&s, t))
return NULL;
word = e+1;
t = strv_env_get_n(env, word+1, e-word-1, flags);
- if (!strextend(&r, t))
+ if (!strextend(&s, t))
return NULL;
word = e--;
assert(flags & REPLACE_ENV_ALLOW_BRACELESS);
t = strv_env_get_n(env, word+1, e-word-1, flags);
- return strjoin(r, t);
+ return strjoin(s, t);
} else
- return strnappend(r, word, e-word);
+ return strnappend(s, word, e-word);
}
char **replace_env_argv(char **argv, char **env) {