From 76070fbf333db47781cc0a2337d9da583536eff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Tue, 14 Jun 2022 13:13:32 +0200 Subject: [PATCH] Simplify client->query initialization Initialize client->query using a compound literal in order to make the ns_query_init() function shorter and more readable. This also prevents the need to explicitly initialize any newly added fields in the future. --- lib/ns/query.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/lib/ns/query.c b/lib/ns/query.c index c40d85ccf1..e63eb956ec 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -799,38 +799,16 @@ ns_query_init(ns_client_t *client) { REQUIRE(NS_CLIENT_VALID(client)); + client->query = (ns_query_t){ 0 }; + ISC_LIST_INIT(client->query.namebufs); ISC_LIST_INIT(client->query.activeversions); ISC_LIST_INIT(client->query.freeversions); - client->query.restarts = 0; - client->query.timerset = false; - client->query.rpz_st = NULL; - client->query.qname = NULL; /* * This mutex is destroyed when the client is destroyed in * exit_check(). */ isc_mutex_init(&client->query.fetchlock); - - client->query.fetch = NULL; - client->query.prefetch = NULL; - client->query.authdb = NULL; - client->query.authzone = NULL; - client->query.authdbset = false; - client->query.isreferral = false; - client->query.dns64_aaaa = NULL; - client->query.dns64_sigaaaa = NULL; - client->query.dns64_aaaaok = NULL; - client->query.dns64_aaaaoklen = 0; - client->query.redirect.db = NULL; - client->query.redirect.node = NULL; - client->query.redirect.zone = NULL; - client->query.redirect.qtype = dns_rdatatype_none; - client->query.redirect.result = ISC_R_SUCCESS; - client->query.redirect.rdataset = NULL; - client->query.redirect.sigrdataset = NULL; - client->query.redirect.authoritative = false; - client->query.redirect.is_zone = false; client->query.redirect.fname = dns_fixedname_initname(&client->query.redirect.fixed); query_reset(client, false);