summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-json/sd-json.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-10-25 19:07:02 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-10-31 03:02:35 +0100
commit32d77f5df8b942805d6084b695be0f72bf1e487d (patch)
treec970004886abbf5a2fd22a089e33044bdc7602c4 /src/libsystemd/sd-json/sd-json.c
parentenv-util: introduce strv_env_get_merged() (diff)
downloadsystemd-32d77f5df8b942805d6084b695be0f72bf1e487d.tar.xz
systemd-32d77f5df8b942805d6084b695be0f72bf1e487d.zip
sd-json: use strv_env_get_merged()
Diffstat (limited to '')
-rw-r--r--src/libsystemd/sd-json/sd-json.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/libsystemd/sd-json/sd-json.c b/src/libsystemd/sd-json/sd-json.c
index 5e9c1ba15b..293df301a2 100644
--- a/src/libsystemd/sd-json/sd-json.c
+++ b/src/libsystemd/sd-json/sd-json.c
@@ -11,6 +11,7 @@
#include "alloc-util.h"
#include "ansi-color.h"
+#include "env-util.h"
#include "errno-util.h"
#include "escape.h"
#include "ether-addr-util.h"
@@ -3867,22 +3868,13 @@ _public_ int sd_json_buildv(sd_json_variant **ret, va_list ap) {
l = va_arg(ap, char **);
- _cleanup_strv_free_ char **el = NULL;
- STRV_FOREACH_PAIR(x, y, l) {
- char *n = NULL;
-
- n = strjoin(*x, "=", *y);
- if (!n) {
- r = -ENOMEM;
- goto finish;
- }
+ if (current->n_suppress == 0) {
+ _cleanup_strv_free_ char **el = NULL;
- r = strv_consume(&el, n);
+ r = strv_env_get_merged(l, &el);
if (r < 0)
goto finish;
- }
- if (current->n_suppress == 0) {
r = sd_json_variant_new_array_strv(&add, el);
if (r < 0)
goto finish;