summaryrefslogtreecommitdiffstats
path: root/src/basic/env-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-05-20 07:15:34 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-05-20 11:18:56 +0200
commit2b070200f1e9b89a00e1da6abfaf15aed130a3ab (patch)
treed360a62bd8ada20a83af97e2cbe8ddeaf99d41f3 /src/basic/env-util.c
parentnetwork: route: make log_route_debug() show weight for multipath route (diff)
downloadsystemd-2b070200f1e9b89a00e1da6abfaf15aed130a3ab.tar.xz
systemd-2b070200f1e9b89a00e1da6abfaf15aed130a3ab.zip
env-util: use strextend()
Diffstat (limited to 'src/basic/env-util.c')
-rw-r--r--src/basic/env-util.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/basic/env-util.c b/src/basic/env-util.c
index 0e8c2878d6..81b1e3f10e 100644
--- a/src/basic/env-util.c
+++ b/src/basic/env-util.c
@@ -572,12 +572,9 @@ char *replace_env_n(const char *format, size_t n, char **env, unsigned flags) {
t = strv_env_get_n(env, word+2, e-word-2, flags);
- k = strjoin(r, t);
- if (!k)
+ if (!strextend(&r, t))
return NULL;
- free_and_replace(r, k);
-
word = e+1;
state = WORD;
} else if (*e == ':') {
@@ -627,12 +624,9 @@ char *replace_env_n(const char *format, size_t n, char **env, unsigned flags) {
else if (!t && state == DEFAULT_VALUE)
t = v = replace_env_n(test_value, e-test_value, env, flags);
- k = strjoin(r, t);
- if (!k)
+ if (!strextend(&r, t))
return NULL;
- free_and_replace(r, k);
-
word = e+1;
state = WORD;
}
@@ -646,12 +640,9 @@ char *replace_env_n(const char *format, size_t n, char **env, unsigned flags) {
t = strv_env_get_n(env, word+1, e-word-1, flags);
- k = strjoin(r, t);
- if (!k)
+ if (!strextend(&r, t))
return NULL;
- free_and_replace(r, k);
-
word = e--;
i--;
state = WORD;