summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-varlink.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-08-24 09:28:42 +0200
committerLennart Poettering <lennart@poettering.net>2023-08-24 13:19:52 +0200
commitc91f581c4706af36f87f911067c4569c0ff08676 (patch)
tree15fbe93f8c7cad4e2928d7e1558239b805718a36 /src/resolve/resolved-varlink.c
parentjson: add json_variant_append_arrayb() helper (diff)
downloadsystemd-c91f581c4706af36f87f911067c4569c0ff08676.tar.xz
systemd-c91f581c4706af36f87f911067c4569c0ff08676.zip
tree-wide: use json_variant_append_arrayb() at many places
Diffstat (limited to '')
-rw-r--r--src/resolve/resolved-varlink.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/resolve/resolved-varlink.c b/src/resolve/resolved-varlink.c
index b27cf90435..1ce1a55876 100644
--- a/src/resolve/resolved-varlink.c
+++ b/src/resolve/resolved-varlink.c
@@ -427,7 +427,6 @@ static void vl_method_resolve_address_complete(DnsQuery *query) {
question = dns_query_question_for_protocol(q, q->answer_protocol);
DNS_ANSWER_FOREACH_IFINDEX(rr, ifindex, q->answer) {
- _cleanup_(json_variant_unrefp) JsonVariant *entry = NULL;
_cleanup_free_ char *normalized = NULL;
r = dns_question_matches_rr(question, rr, NULL);
@@ -440,14 +439,11 @@ static void vl_method_resolve_address_complete(DnsQuery *query) {
if (r < 0)
goto finish;
- r = json_build(&entry,
- JSON_BUILD_OBJECT(
- JSON_BUILD_PAIR_CONDITION(ifindex > 0, "ifindex", JSON_BUILD_INTEGER(ifindex)),
- JSON_BUILD_PAIR("name", JSON_BUILD_STRING(normalized))));
- if (r < 0)
- goto finish;
-
- r = json_variant_append_array(&array, entry);
+ r = json_variant_append_arrayb(
+ &array,
+ JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR_CONDITION(ifindex > 0, "ifindex", JSON_BUILD_INTEGER(ifindex)),
+ JSON_BUILD_PAIR("name", JSON_BUILD_STRING(normalized))));
if (r < 0)
goto finish;
}