From: Michał Kępień Date: Tue, 14 Jun 2022 11:13:32 +0000 (+0200) Subject: Simplify client->query initialization X-Git-Tag: v9.19.3~49^2~3 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=76070fbf333db47781cc0a2337d9da583536eff2;p=thirdparty%2Fbind9.git 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. --- diff --git a/lib/ns/query.c b/lib/ns/query.c index c40d85ccf1d..e63eb956ecf 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);