diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-10-27 14:28:25 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-10-28 10:00:28 +0100 |
commit | 1ed314087fab3988f3221b1b736a7e711f174349 (patch) | |
tree | e0ebb573c8e8f525cfac46fa0c8539d7a34ff20e /src/resolve/resolved-dns-query.c | |
parent | a149d4a95eabe39f36e913f0a0ad9c84007b4e4f (diff) | |
download | systemd-1ed314087fab3988f3221b1b736a7e711f174349.tar.gz |
resolved: use structured initialization everywhere
Diffstat (limited to 'src/resolve/resolved-dns-query.c')
-rw-r--r-- | src/resolve/resolved-dns-query.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c index 1eff893b21..ef54c04ab0 100644 --- a/src/resolve/resolved-dns-query.c +++ b/src/resolve/resolved-dns-query.c @@ -21,12 +21,14 @@ static int dns_query_candidate_new(DnsQueryCandidate **ret, DnsQuery *q, DnsScop assert(q); assert(s); - c = new0(DnsQueryCandidate, 1); + c = new(DnsQueryCandidate, 1); if (!c) return -ENOMEM; - c->query = q; - c->scope = s; + *c = (DnsQueryCandidate) { + .query = q, + .scope = s, + }; LIST_PREPEND(candidates_by_query, q->candidates, c); LIST_PREPEND(candidates_by_scope, s->query_candidates, c); @@ -413,17 +415,19 @@ int dns_query_new( if (m->n_dns_queries >= QUERIES_MAX) return -EBUSY; - q = new0(DnsQuery, 1); + q = new(DnsQuery, 1); if (!q) return -ENOMEM; - q->question_utf8 = dns_question_ref(question_utf8); - q->question_idna = dns_question_ref(question_idna); - q->ifindex = ifindex; - q->flags = flags; - q->answer_dnssec_result = _DNSSEC_RESULT_INVALID; - q->answer_protocol = _DNS_PROTOCOL_INVALID; - q->answer_family = AF_UNSPEC; + *q = (DnsQuery) { + .question_utf8 = dns_question_ref(question_utf8), + .question_idna = dns_question_ref(question_idna), + .ifindex = ifindex, + .flags = flags, + .answer_dnssec_result = _DNSSEC_RESULT_INVALID, + .answer_protocol = _DNS_PROTOCOL_INVALID, + .answer_family = AF_UNSPEC, + }; /* First dump UTF8 question */ DNS_QUESTION_FOREACH(key, question_utf8) |