]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Simplify client->query initialization
authorMichał Kępień <michal@isc.org>
Tue, 14 Jun 2022 11:13:32 +0000 (13:13 +0200)
committerMichał Kępień <michal@isc.org>
Tue, 14 Jun 2022 11:13:32 +0000 (13:13 +0200)
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

index c40d85ccf1d9440d8ab41a57b15a3af57a111eb3..e63eb956ecf30d1d5affdfebda1c833aeac12570 100644 (file)
@@ -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);