]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
switch to RETERR where it wasn't being used
authorEvan Hunt <each@isc.org>
Fri, 13 Jun 2025 05:17:33 +0000 (22:17 -0700)
committerEvan Hunt <each@isc.org>
Wed, 3 Dec 2025 21:45:43 +0000 (13:45 -0800)
replace all instances of the pattern:

        result = <statement>
        if (result != ISC_R_SUCCESS) {
                return result;
        }

with:

        RETERR(<statement>);

99 files changed:
bin/check/named-checkconf.c
bin/delv/delv.c
bin/dig/dig.c
bin/dig/dighost.c
bin/dig/host.c
bin/dnssec/dnssec-ksr.c
bin/dnssec/dnssec-signzone.c
bin/named/builtin.c
bin/named/config.c
bin/named/control.c
bin/named/server.c
bin/named/zoneconf.c
bin/plugins/synthrecord.c
bin/tests/system/dlzexternal/driver/driver.c
bin/tools/named-makejournal.c
lib/dns/acl.c
lib/dns/adb.c
lib/dns/cache.c
lib/dns/catz.c
lib/dns/db.c
lib/dns/dispatch.c
lib/dns/dns64.c
lib/dns/dnssec.c
lib/dns/ds.c
lib/dns/dst_api.c
lib/dns/dst_parse.c
lib/dns/hmac_link.c
lib/dns/iptable.c
lib/dns/journal.c
lib/dns/keystore.c
lib/dns/keytable.c
lib/dns/master.c
lib/dns/masterdump.c
lib/dns/message.c
lib/dns/name.c
lib/dns/ncache.c
lib/dns/nsec.c
lib/dns/nsec3.c
lib/dns/nta.c
lib/dns/opensslecdsa_link.c
lib/dns/openssleddsa_link.c
lib/dns/peer.c
lib/dns/qpcache.c
lib/dns/rdata.c
lib/dns/rdata/generic/lp_107.c
lib/dns/rdata/generic/minfo_14.c
lib/dns/rdata/generic/mx_15.c
lib/dns/rdata/generic/naptr_35.c
lib/dns/rdata/generic/nxt_30.c
lib/dns/rdata/generic/rt_21.c
lib/dns/rdata/generic/txt_16.c
lib/dns/rdata/in_1/a6_38.c
lib/dns/rdata/in_1/px_26.c
lib/dns/rdata/in_1/srv_33.c
lib/dns/rdataset.c
lib/dns/request.c
lib/dns/resconf.c
lib/dns/resolver.c
lib/dns/rootns.c
lib/dns/rpz.c
lib/dns/rriterator.c
lib/dns/sdlz.c
lib/dns/skr.c
lib/dns/time.c
lib/dns/tkey.c
lib/dns/tsig.c
lib/dns/update.c
lib/dns/validator.c
lib/dns/view.c
lib/dns/xfrin.c
lib/dns/zone.c
lib/dns/zoneverify.c
lib/isc/commandline.c
lib/isc/file.c
lib/isc/getaddresses.c
lib/isc/httpd.c
lib/isc/include/isc/buffer.h
lib/isc/lex.c
lib/isc/log.c
lib/isc/netmgr/udp.c
lib/isc/parseint.c
lib/isc/proxy2.c
lib/isc/radix.c
lib/isc/sockaddr.c
lib/isc/url.c
lib/isccc/base64.c
lib/isccc/cc.c
lib/isccfg/aclconf.c
lib/isccfg/check.c
lib/isccfg/parser.c
lib/ns/client.c
lib/ns/interfacemgr.c
lib/ns/query.c
lib/ns/update.c
lib/ns/xfrout.c
tests/dns/dispatch_test.c
tests/dns/master_test.c
tests/libtest/dns.c
tests/libtest/ns.c

index caac86ee2561b032db97d1f63ed07efa86b2990d..ee304a9b204f49492de00c118b24ac37ca5c4d5a 100644 (file)
@@ -108,7 +108,6 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
 
 static isc_result_t
 configure_hint(const char *zfile, const char *zclass) {
-       isc_result_t result;
        dns_db_t *db = NULL;
        dns_rdataclass_t rdclass;
        isc_textregion_t r;
@@ -119,15 +118,8 @@ configure_hint(const char *zfile, const char *zclass) {
 
        r.base = UNCONST(zclass);
        r.length = strlen(zclass);
-       result = dns_rdataclass_fromtext(&rdclass, &r);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = dns_rootns_create(isc_g_mctx, rdclass, zfile, &db);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdataclass_fromtext(&rdclass, &r));
+       RETERR(dns_rootns_create(isc_g_mctx, rdclass, zfile, &db));
 
        dns_db_detach(&db);
        return ISC_R_SUCCESS;
index eba04e85b12007bb97e315264c2ec22c54592b79..7915c4f80896a4db3ed36776d2b203691c82c2d7 100644 (file)
@@ -1757,15 +1757,8 @@ reverse_octets(const char *in, char **p, char *end) {
        char *dot = strchr(in, '.');
        int len;
        if (dot != NULL) {
-               isc_result_t result;
-               result = reverse_octets(dot + 1, p, end);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
-               result = append_str(".", 1, p, end);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(reverse_octets(dot + 1, p, end));
+               RETERR(append_str(".", 1, p, end));
                len = (int)(dot - in);
        } else {
                len = strlen(in);
@@ -1776,7 +1769,6 @@ reverse_octets(const char *in, char **p, char *end) {
 static isc_result_t
 get_reverse(char *reverse, size_t len, char *value, bool strict) {
        int r;
-       isc_result_t result;
        isc_netaddr_t addr;
 
        addr.family = AF_INET6;
@@ -1787,10 +1779,7 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
                dns_name_t *name;
 
                name = dns_fixedname_initname(&fname);
-               result = dns_byaddr_createptrname(&addr, name);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_byaddr_createptrname(&addr, name));
                dns_name_format(name, reverse, (unsigned int)len);
                return ISC_R_SUCCESS;
        } else {
@@ -1807,14 +1796,8 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
                if (strict && inet_pton(AF_INET, value, &addr.type.in) != 1) {
                        return DNS_R_BADDOTTEDQUAD;
                }
-               result = reverse_octets(value, &p, end);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
-               result = append_str(".in-addr.arpa.", 15, &p, end);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(reverse_octets(value, &p, end));
+               RETERR(append_str(".in-addr.arpa.", 15, &p, end));
                return ISC_R_SUCCESS;
        }
 }
index b1d12ec2b60a82e58b607145f7a266fa4ef78b08..ecb722b78e53c92b7e7fbd3f4c68410dbd2d7df6 100644 (file)
@@ -503,10 +503,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
        unsigned int styleflags = 0;
 
        if (query->lookup->trace || query->lookup->ns_search_only) {
-               result = dns_rdatatype_totext(rdata->type, buf);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rdatatype_totext(rdata->type, buf));
                ADD_STRING(buf, " ");
        }
 
@@ -583,14 +580,8 @@ dns64prefix_answer(dns_message_t *msg, isc_buffer_t *buf) {
                count = 10;
        }
        for (i = 0; i < count; i++) {
-               result = isc_netaddr_totext(&prefix[i].addr, buf);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
-               result = isc_buffer_printf(buf, "/%u\n", prefix[i].prefixlen);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(isc_netaddr_totext(&prefix[i].addr, buf));
+               RETERR(isc_buffer_printf(buf, "/%u\n", prefix[i].prefixlen));
        }
 
        return ISC_R_SUCCESS;
index 81d1cc552bdb9532d6d51e61436d9055d0d6091d..1eeb11e4329890fc4bfdd57208ee2ca39cfe3ca3 100644 (file)
@@ -291,15 +291,8 @@ reverse_octets(const char *in, char **p, char *end) {
        const char *dot = strchr(in, '.');
        size_t len;
        if (dot != NULL) {
-               isc_result_t result;
-               result = reverse_octets(dot + 1, p, end);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
-               result = append(".", 1, p, end);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(reverse_octets(dot + 1, p, end));
+               RETERR(append(".", 1, p, end));
                len = (int)(dot - in);
        } else {
                len = (int)strlen(in);
@@ -310,7 +303,6 @@ reverse_octets(const char *in, char **p, char *end) {
 isc_result_t
 get_reverse(char *reverse, size_t len, char *value, bool strict) {
        int r;
-       isc_result_t result;
        isc_netaddr_t addr;
 
        addr.family = AF_INET6;
@@ -321,10 +313,7 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
                dns_name_t *name;
 
                name = dns_fixedname_initname(&fname);
-               result = dns_byaddr_createptrname(&addr, name);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_byaddr_createptrname(&addr, name));
                dns_name_format(name, reverse, (unsigned int)len);
                return ISC_R_SUCCESS;
        } else {
@@ -341,15 +330,9 @@ get_reverse(char *reverse, size_t len, char *value, bool strict) {
                if (strict && inet_pton(AF_INET, value, &addr.type.in) != 1) {
                        return DNS_R_BADDOTTEDQUAD;
                }
-               result = reverse_octets(value, &p, end);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(reverse_octets(value, &p, end));
                /* Append .in-addr.arpa. and a terminating NUL. */
-               result = append(".in-addr.arpa.", 15, &p, end);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(append(".in-addr.arpa.", 15, &p, end));
                return ISC_R_SUCCESS;
        }
 }
index df38b0f24aad791470f4cee3176555f5d0d27a9d..4156aec9a80a7da7aaee621b1b3c6eda1d9a3374 100644 (file)
@@ -208,7 +208,6 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
             const char *section_name, bool headers, dig_query_t *query) {
        dns_name_t *print_name;
        isc_buffer_t target;
-       isc_result_t result;
        isc_region_t r;
        dns_name_t empty_name;
        char tbuf[4096] = { 0 };
@@ -245,12 +244,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
                                continue;
                        }
                        if (!short_form) {
-                               result = dns_rdataset_totext(rdataset,
-                                                            print_name, false,
-                                                            no_rdata, &target);
-                               if (result != ISC_R_SUCCESS) {
-                                       return result;
-                               }
+                               RETERR(dns_rdataset_totext(rdataset, print_name,
+                                                          false, no_rdata,
+                                                          &target));
 #ifdef USEINITALWS
                                if (first) {
                                        print_name = &empty_name;
@@ -305,7 +301,6 @@ static isc_result_t
 printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
           const dns_name_t *owner, const char *set_name, bool headers) {
        isc_buffer_t target;
-       isc_result_t result;
        isc_region_t r;
        char tbuf[4096];
 
@@ -316,10 +311,7 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
 
        isc_buffer_init(&target, tbuf, sizeof(tbuf));
 
-       result = dns_rdataset_totext(rdataset, owner, false, false, &target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdataset_totext(rdataset, owner, false, false, &target));
        isc_buffer_usedregion(&target, &r);
        printf("%.*s", (int)r.length, (char *)r.base);
 
@@ -501,50 +493,35 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
        if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_QUESTION]) && !short_form)
        {
                printf("\n");
-               result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
-                                     true, query);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(printsection(msg, DNS_SECTION_QUESTION, "QUESTION", true,
+                                   query));
        }
        if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ANSWER])) {
                if (!short_form) {
                        printf("\n");
                }
-               result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
-                                     !short_form, query);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
+                                   !short_form, query));
        }
 
        if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY]) &&
            !short_form)
        {
                printf("\n");
-               result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
-                                     true, query);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
+                                   true, query));
        }
        if (!ISC_LIST_EMPTY(msg->sections[DNS_SECTION_ADDITIONAL]) &&
            !short_form)
        {
                printf("\n");
-               result = printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL",
-                                     true, query);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(printsection(msg, DNS_SECTION_ADDITIONAL, "ADDITIONAL",
+                                   true, query));
        }
        if ((tsig != NULL) && !short_form) {
                printf("\n");
-               result = printrdata(msg, tsig, tsigname, "PSEUDOSECTION TSIG",
-                                   true);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(printrdata(msg, tsig, tsigname, "PSEUDOSECTION TSIG",
+                                 true));
        }
        if (!short_form) {
                printf("\n");
index 7240da4278650d42b62551837ae8b140e82aab3e..efba16f451835969304b6eaa9ed3ab8c2b79da99 100644 (file)
@@ -967,10 +967,7 @@ parse_dnskey(isc_lex_t *lex, char *owner, isc_buffer_t *buf, dns_ttl_t *ttl) {
        dname = dns_fixedname_initname(&dfname);
        isc_buffer_init(&b, owner, strlen(owner));
        isc_buffer_add(&b, strlen(owner));
-       result = dns_name_fromtext(dname, &b, dns_rootname, 0);
-       if (result != ISC_R_SUCCESS) {
-               goto cleanup;
-       }
+       CHECK(dns_name_fromtext(dname, &b, dns_rootname, 0));
        if (dns_name_compare(dname, name) != 0) {
                result = DNS_R_BADOWNERNAME;
                goto cleanup;
index 43a295ca2a878c0e9621d4541058edfdc52c3f67..4502d00720ff175ef42cad08a4817a77ba450ec3 100644 (file)
@@ -1377,10 +1377,7 @@ setsoaserial(uint32_t serial, dns_updatemethod_t method) {
        uint32_t old_serial, new_serial = 0;
        dns_updatemethod_t used = dns_updatemethod_none;
 
-       result = dns_db_getoriginnode(gdb, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getoriginnode(gdb, &node));
 
        dns_rdataset_init(&rdataset);
 
index 814ad911bd4be8ac4cf92dedf7471e8459cd0d16..80e3c5a7fe52a3fd3eb240615a127df262b56bf9 100644 (file)
@@ -166,10 +166,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
        origin = &node->bdb->common.origin;
 
        isc_constregion_t r = { .base = type, .length = strlen(type) };
-       result = dns_rdatatype_fromtext(&typeval, (isc_textregion_t *)&r);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdatatype_fromtext(&typeval, (isc_textregion_t *)&r));
 
        isc_lex_create(mctx, 64, &lex);
 
@@ -177,10 +174,7 @@ putrr(bdbnode_t *node, const char *type, dns_ttl_t ttl, const char *data) {
        isc_buffer_constinit(&b, data, datalen);
        isc_buffer_add(&b, datalen);
 
-       result = isc_lex_openbuffer(lex, &b);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_lex_openbuffer(lex, &b));
 
        isc_buffer_allocate(mctx, &rb, DNS_RDATA_MAXLENGTH);
        result = dns_rdata_fromtext(NULL, node->bdb->common.rdclass, typeval,
@@ -535,7 +529,6 @@ hostname_lookup(bdbnode_t *node) {
 
 static isc_result_t
 authors_lookup(bdbnode_t *node) {
-       isc_result_t result;
        const char **p = NULL;
        static const char *authors[] = {
                "Mark Andrews",       "Curtis Blackburn",
@@ -559,10 +552,7 @@ authors_lookup(bdbnode_t *node) {
        }
 
        for (p = authors; *p != NULL; p++) {
-               result = puttxt(node, *p);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(puttxt(node, *p));
        }
        return ISC_R_SUCCESS;
 }
@@ -591,14 +581,10 @@ empty_lookup(bdbnode_t *node) {
 
 static isc_result_t
 ipv4only_lookup(bdbnode_t *node) {
-       isc_result_t result;
        unsigned char data[2][4] = { { 192, 0, 0, 170 }, { 192, 0, 0, 171 } };
 
        for (int i = 0; i < 2; i++) {
-               result = putrdata(node, dns_rdatatype_a, 3600, data[i], 4);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(putrdata(node, dns_rdatatype_a, 3600, data[i], 4));
        }
        return ISC_R_SUCCESS;
 }
@@ -846,10 +832,7 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
        dns_name_getlabelsequence(name, 0, labels, &relname);
        name = &relname;
 
-       result = createnode(bdb, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(createnode(bdb, &node));
 
        result = builtin_lookup(bdb, name, node);
        if (result != ISC_R_SUCCESS && (!isorigin || result != ISC_R_NOTFOUND))
@@ -1212,11 +1195,8 @@ isc_result_t
 named_builtin_init(void) {
        isc_result_t result;
 
-       result = dns_db_register("_builtin", create, &builtin, isc_g_mctx,
-                                &builtin.dbimp);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_register("_builtin", create, &builtin, isc_g_mctx,
+                              &builtin.dbimp));
 
        result = dns_db_register("_dns64", create, &dns64, isc_g_mctx,
                                 &dns64.dbimp);
index 31683d005cae6d7c8d1a68e80294a87750cb65f1..c953f4c45a975f410617084e5a0bedfee485a375 100644 (file)
@@ -248,17 +248,13 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
 isc_result_t
 named_config_getremotesdef(const cfg_obj_t *cctx, const char *list,
                           const char *name, const cfg_obj_t **ret) {
-       isc_result_t result;
        const cfg_obj_t *obj = NULL;
 
        REQUIRE(cctx != NULL);
        REQUIRE(name != NULL);
        REQUIRE(ret != NULL && *ret == NULL);
 
-       result = cfg_map_get(cctx, list, &obj);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(cfg_map_get(cctx, list, &obj));
        CFG_LIST_FOREACH(obj, elt) {
                obj = cfg_listelt_value(elt);
                if (strcasecmp(cfg_obj_asstring(cfg_tuple_get(obj, "name")),
@@ -697,7 +693,6 @@ named_config_getkeyalgorithm(const char *str, unsigned int *typep,
        int i;
        size_t len = 0;
        uint16_t bits;
-       isc_result_t result;
 
        for (i = 0; algorithms[i].str != NULL; i++) {
                len = strlen(algorithms[i].str);
@@ -712,10 +707,7 @@ named_config_getkeyalgorithm(const char *str, unsigned int *typep,
                return ISC_R_NOTFOUND;
        }
        if (str[len] == '-') {
-               result = isc_parse_uint16(&bits, str + len + 1, 10);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(isc_parse_uint16(&bits, str + len + 1, 10));
                if (bits > algorithms[i].size) {
                        return ISC_R_RANGE;
                }
index 8f20933f021d20bc5b543bf9d148d0c5c042f59d..8750f4c7f2eee0b3f076af21a0d710d1a53b228e 100644 (file)
 
 static isc_result_t
 getcommand(isc_lex_t *lex, char **cmdp) {
-       isc_result_t result;
        isc_token_t token;
 
        REQUIRE(cmdp != NULL && *cmdp == NULL);
 
-       result = isc_lex_gettoken(lex, ISC_LEXOPT_EOF, &token);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_lex_gettoken(lex, ISC_LEXOPT_EOF, &token));
 
        isc_lex_ungettoken(lex, &token);
 
@@ -89,13 +85,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
                return ISC_R_FAILURE;
        }
 
-       result = isccc_cc_lookupstring(data, "type", &cmdline);
-       if (result != ISC_R_SUCCESS) {
-               /*
-                * We have no idea what this is.
-                */
-               return result;
-       }
+       RETERR(isccc_cc_lookupstring(data, "type", &cmdline));
 
        isc_lex_create(isc_g_mctx, strlen(cmdline), &lex);
 
index 7aeeec2b87f4f3fecb42770e672c41ce17f27019..b6ca56d9a453f91b3bf74c0a5315ab92d45c8be5 100644 (file)
@@ -928,10 +928,7 @@ process_key(const cfg_obj_t *key, dns_keytable_t *secroots,
                isc_buffer_constinit(&b, namestr, strlen(namestr));
                isc_buffer_add(&b, strlen(namestr));
                keyname = dns_fixedname_initname(&fkeyname);
-               result = dns_name_fromtext(keyname, &b, dns_rootname, 0);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_name_fromtext(keyname, &b, dns_rootname, 0));
                break;
        case DST_R_UNSUPPORTEDALG:
        case DST_R_BADKEYTYPE:
@@ -1290,20 +1287,12 @@ configure_order(dns_order_t *order, const cfg_obj_t *ent) {
        dns_orderopt_t mode = dns_order_none;
        const char *str;
        isc_buffer_t b;
-       isc_result_t result;
        bool addroot;
 
-       result = named_config_getclass(cfg_tuple_get(ent, "class"),
-                                      dns_rdataclass_any, &rdclass);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = named_config_gettype(cfg_tuple_get(ent, "type"),
-                                     dns_rdatatype_any, &rdtype);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(named_config_getclass(cfg_tuple_get(ent, "class"),
+                                    dns_rdataclass_any, &rdclass));
+       RETERR(named_config_gettype(cfg_tuple_get(ent, "type"),
+                                   dns_rdatatype_any, &rdtype));
 
        obj = cfg_tuple_get(ent, "name");
        if (cfg_obj_isstring(obj)) {
@@ -1315,11 +1304,8 @@ configure_order(dns_order_t *order, const cfg_obj_t *ent) {
        isc_buffer_constinit(&b, str, strlen(str));
        isc_buffer_add(&b, strlen(str));
        dns_fixedname_init(&fixed);
-       result = dns_name_fromtext(dns_fixedname_name(&fixed), &b, dns_rootname,
-                                  0);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromtext(dns_fixedname_name(&fixed), &b, dns_rootname,
+                                0));
 
        obj = cfg_tuple_get(ent, "ordering");
        INSIST(cfg_obj_isstring(obj));
@@ -1354,19 +1340,14 @@ configure_order(dns_order_t *order, const cfg_obj_t *ent) {
 static isc_result_t
 configure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
        isc_netaddr_t na;
-       dns_peer_t *peer;
-       const cfg_obj_t *obj;
-       const char *str;
-       isc_result_t result;
+       dns_peer_t *peer = NULL;
+       const cfg_obj_t *obj = NULL;
+       isc_result_t result = ISC_R_SUCCESS;
        unsigned int prefixlen;
 
        cfg_obj_asnetprefix(cfg_map_getname(cpeer), &na, &prefixlen);
 
-       peer = NULL;
-       result = dns_peer_newprefix(mctx, &na, prefixlen, &peer);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_peer_newprefix(mctx, &na, prefixlen, &peer));
 
        obj = NULL;
        (void)cfg_map_get(cpeer, "bogus", &obj);
@@ -1500,7 +1481,7 @@ configure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
        obj = NULL;
        (void)cfg_map_get(cpeer, "transfer-format", &obj);
        if (obj != NULL) {
-               str = cfg_obj_asstring(obj);
+               const char *str = cfg_obj_asstring(obj);
                if (strcasecmp(str, "many-answers") == 0) {
                        CHECK(dns_peer_settransferformat(peer,
                                                         dns_many_answers));
@@ -1792,12 +1773,9 @@ static isc_result_t
 dlzconfigure_callback(dns_view_t *view, dns_dlzdb_t *dlzdb, dns_zone_t *zone) {
        dns_name_t *origin = dns_zone_getorigin(zone);
        dns_rdataclass_t zclass = view->rdclass;
-       isc_result_t result;
 
-       result = dns_zonemgr_managezone(named_g_server->zonemgr, zone);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_zonemgr_managezone(named_g_server->zonemgr, zone));
+
        dns_zone_setstats(zone, named_g_server->zonestats);
 
        return named_zone_configure_writeable_dlz(dlzdb, zone, zclass, origin);
@@ -1978,10 +1956,8 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element,
        }
 
        str = cfg_obj_asstring(cfg_tuple_get(rpz_obj, "zone name"));
-       result = configure_rpz_name(view, rpz_obj, &zone->origin, str, "zone");
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(configure_rpz_name(view, rpz_obj, &zone->origin, str, "zone"));
+
        if (dns_name_equal(&zone->origin, dns_rootname)) {
                cfg_obj_log(rpz_obj, DNS_RPZ_ERROR_LEVEL,
                            "invalid zone name '%s'", str);
@@ -2001,47 +1977,20 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element,
                *old_rpz_okp = false;
        }
 
-       result = configure_rpz_name2(view, rpz_obj, &zone->client_ip,
-                                    DNS_RPZ_CLIENT_IP_ZONE, &zone->origin);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = configure_rpz_name2(view, rpz_obj, &zone->ip, DNS_RPZ_IP_ZONE,
-                                    &zone->origin);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = configure_rpz_name2(view, rpz_obj, &zone->nsdname,
-                                    DNS_RPZ_NSDNAME_ZONE, &zone->origin);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = configure_rpz_name2(view, rpz_obj, &zone->nsip,
-                                    DNS_RPZ_NSIP_ZONE, &zone->origin);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = configure_rpz_name(view, rpz_obj, &zone->passthru,
-                                   DNS_RPZ_PASSTHRU_NAME, "name");
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = configure_rpz_name(view, rpz_obj, &zone->drop,
-                                   DNS_RPZ_DROP_NAME, "name");
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = configure_rpz_name(view, rpz_obj, &zone->tcp_only,
-                                   DNS_RPZ_TCP_ONLY_NAME, "name");
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(configure_rpz_name2(view, rpz_obj, &zone->client_ip,
+                                  DNS_RPZ_CLIENT_IP_ZONE, &zone->origin));
+       RETERR(configure_rpz_name2(view, rpz_obj, &zone->ip, DNS_RPZ_IP_ZONE,
+                                  &zone->origin));
+       RETERR(configure_rpz_name2(view, rpz_obj, &zone->nsdname,
+                                  DNS_RPZ_NSDNAME_ZONE, &zone->origin));
+       RETERR(configure_rpz_name2(view, rpz_obj, &zone->nsip,
+                                  DNS_RPZ_NSIP_ZONE, &zone->origin));
+       RETERR(configure_rpz_name(view, rpz_obj, &zone->passthru,
+                                 DNS_RPZ_PASSTHRU_NAME, "name"));
+       RETERR(configure_rpz_name(view, rpz_obj, &zone->drop, DNS_RPZ_DROP_NAME,
+                                 "name"));
+       RETERR(configure_rpz_name(view, rpz_obj, &zone->tcp_only,
+                                 DNS_RPZ_TCP_ONLY_NAME, "name"));
 
        obj = cfg_tuple_get(rpz_obj, "policy");
        if (cfg_obj_isvoid(obj)) {
@@ -2052,11 +2001,8 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element,
                INSIST(zone->policy != DNS_RPZ_POLICY_ERROR);
                if (zone->policy == DNS_RPZ_POLICY_CNAME) {
                        str = cfg_obj_asstring(cfg_tuple_get(obj, "cname"));
-                       result = configure_rpz_name(view, rpz_obj, &zone->cname,
-                                                   str, "cname");
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(configure_rpz_name(view, rpz_obj, &zone->cname,
+                                                 str, "cname"));
                }
        }
        if (*old_rpz_okp && (zone->policy != old->policy ||
@@ -2104,7 +2050,7 @@ configure_rpz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t *rpz_obj,
        const dns_rpz_zones_t *old = NULL;
        bool pview_must_detach = false;
        const dns_rpz_zone_t *old_zone = NULL;
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
 
        *old_rpz_okp = false;
 
@@ -2127,10 +2073,7 @@ configure_rpz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t *rpz_obj,
        }
        nsdname_on = nsdname_enabled ? DNS_RPZ_ALL_ZBITS : 0;
 
-       result = dns_rpz_new_zones(view, &view->rpzs, first_time);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rpz_new_zones(view, &view->rpzs, first_time));
 
        zones = view->rpzs;
 
@@ -2635,11 +2578,10 @@ static void
 catz_changeview(dns_catz_entry_t *entry, void *arg1, void *arg2) {
        dns_view_t *pview = arg1;
        dns_view_t *view = arg2;
-
        dns_zone_t *zone = NULL;
+
        isc_result_t result = dns_view_findzone(
                pview, dns_catz_entry_getname(entry), DNS_ZTFIND_EXACT, &zone);
-
        if (result != ISC_R_SUCCESS) {
                return;
        }
@@ -2940,10 +2882,7 @@ configure_rrl(dns_view_t *view, const cfg_obj_t *config, const cfg_obj_t *map,
                        min_entries = 1;
                }
        }
-       result = dns_rrl_init(&rrl, view, min_entries);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rrl_init(&rrl, view, min_entries));
 
        i = ISC_MAX(20000, min_entries);
        obj = NULL;
@@ -5706,7 +5645,7 @@ configure_forward(const cfg_obj_t *config, dns_view_t *view,
        const cfg_obj_t *faddresses = NULL;
        dns_fwdpolicy_t fwdpolicy = dns_fwdpolicy_none;
        dns_forwarderlist_t fwdlist;
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        in_port_t port;
        in_port_t tls_port;
        const char *tls = NULL;
@@ -5740,11 +5679,8 @@ configure_forward(const cfg_obj_t *config, dns_view_t *view,
                if (cfg_obj_isstring(tlspobj)) {
                        tls = cfg_obj_asstring(tlspobj);
                        if (tls != NULL) {
-                               result = validate_tls(config, view, tlspobj,
-                                                     tls, NULL);
-                               if (result != ISC_R_SUCCESS) {
-                                       return result;
-                               }
+                               RETERR(validate_tls(config, view, tlspobj, tls,
+                                                   NULL));
                        }
                }
        }
@@ -5820,8 +5756,6 @@ configure_forward(const cfg_obj_t *config, dns_view_t *view,
                dns_view_sfd_add(view, origin);
        }
 
-       result = ISC_R_SUCCESS;
-
 cleanup:
 
        ISC_LIST_FOREACH(fwdlist, fwd, link) {
@@ -5881,20 +5815,12 @@ cleanup:
 static isc_result_t
 find_view(const cfg_obj_t *vconfig, dns_viewlist_t *viewlist,
          dns_view_t **viewp) {
-       isc_result_t result;
        const char *viewname = NULL;
        dns_rdataclass_t viewclass;
        dns_view_t *view = NULL;
 
-       result = get_viewinfo(vconfig, &viewname, &viewclass);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = dns_viewlist_find(viewlist, viewname, viewclass, &view);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(get_viewinfo(vconfig, &viewname, &viewclass));
+       RETERR(dns_viewlist_find(viewlist, viewname, viewclass, &view));
 
        *viewp = view;
        return ISC_R_SUCCESS;
@@ -5915,10 +5841,7 @@ create_view(const cfg_obj_t *vconfig, dns_viewlist_t *viewlist,
        dns_rdataclass_t viewclass;
        dns_view_t *view = NULL;
 
-       result = get_viewinfo(vconfig, &viewname, &viewclass);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(get_viewinfo(vconfig, &viewname, &viewclass));
 
        result = dns_viewlist_find(viewlist, viewname, viewclass, &view);
        if (result == ISC_R_SUCCESS) {
@@ -6886,11 +6809,8 @@ generate_session_key(const char *filename, const char *keynamestr,
                      ISC_LOG_INFO, "generating session key for dynamic DNS");
 
        /* generate key */
-       result = dst_key_generate(keyname, alg, bits, 1, 0, DNS_KEYPROTO_ANY,
-                                 dns_rdataclass_in, NULL, mctx, &key, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_generate(keyname, alg, bits, 1, 0, DNS_KEYPROTO_ANY,
+                               dns_rdataclass_in, NULL, mctx, &key, NULL));
 
        /*
         * Dump the key to the buffer for later use.
@@ -6974,10 +6894,7 @@ configure_session_key(const cfg_obj_t **maps, named_server_t *server,
        isc_buffer_constinit(&buffer, keynamestr, strlen(keynamestr));
        isc_buffer_add(&buffer, strlen(keynamestr));
        keyname = dns_fixedname_initname(&fname);
-       result = dns_name_fromtext(keyname, &buffer, dns_rootname, 0);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromtext(keyname, &buffer, dns_rootname, 0));
 
        obj = NULL;
        result = named_config_get(maps, "session-keyalg", &obj);
@@ -7665,10 +7582,7 @@ configure_views(cfg_obj_t *config, const cfg_obj_t *bindkeys,
                cfg_obj_t *vconfig = cfg_listelt_value(element);
                dns_view_t *view = NULL;
 
-               result = find_view(vconfig, viewlist, &view);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(find_view(vconfig, viewlist, &view));
 
                result = configure_view(view, viewlist, config, vconfig,
                                        cachelist, &server->cachelist, kasplist,
@@ -7695,10 +7609,7 @@ configure_views(cfg_obj_t *config, const cfg_obj_t *bindkeys,
         */
        if (explicitviews == false) {
                dns_view_t *view = NULL;
-               result = find_view(NULL, viewlist, &view);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(find_view(NULL, viewlist, &view));
                result = configure_view(view, viewlist, config, NULL, cachelist,
                                        &server->cachelist, kasplist, bindkeys,
                                        isc_g_mctx, aclctx, tlsctx_client_cache,
@@ -7745,10 +7656,7 @@ configure_keystores(const cfg_obj_t *config, dns_keystorelist_t *keystorelist) {
        /*
         * Create the built-in key store ("key-directory").
         */
-       result = cfg_keystore_fromconfig(NULL, isc_g_mctx, keystorelist, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(cfg_keystore_fromconfig(NULL, isc_g_mctx, keystorelist, NULL));
 
        /*
         * Create the DNSSEC key stores.
@@ -7758,11 +7666,8 @@ configure_keystores(const cfg_obj_t *config, dns_keystorelist_t *keystorelist) {
        CFG_LIST_FOREACH(keystores, element) {
                cfg_obj_t *kconfig = cfg_listelt_value(element);
 
-               result = cfg_keystore_fromconfig(kconfig, isc_g_mctx,
-                                                keystorelist, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(cfg_keystore_fromconfig(kconfig, isc_g_mctx,
+                                              keystorelist, NULL));
        }
 
        return result;
@@ -7788,13 +7693,9 @@ configure_kasplist(const cfg_obj_t *config, dns_kasplist_t *kasplist,
                cfg_obj_t *kconfig = cfg_listelt_value(element);
                dns_kasp_t *kasp = NULL;
 
-               result = cfg_kasp_fromconfig(kconfig, default_kasp, kaspopts,
-                                            isc_g_mctx, keystorelist, kasplist,
-                                            &kasp);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
-
+               RETERR(cfg_kasp_fromconfig(kconfig, default_kasp, kaspopts,
+                                          isc_g_mctx, keystorelist, kasplist,
+                                          &kasp));
                INSIST(kasp != NULL);
                dns_kasp_freeze(kasp);
 
@@ -10091,7 +9992,7 @@ cleanup:
 isc_result_t
 named_server_retransfercommand(named_server_t *server, isc_lex_t *lex,
                               isc_buffer_t *text) {
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        const char *arg = NULL;
        dns_zone_t *zone = NULL;
        dns_zone_t *raw = NULL;
@@ -10109,10 +10010,8 @@ named_server_retransfercommand(named_server_t *server, isc_lex_t *lex,
                arg = next_token(lex, text);
        }
 
-       result = zone_from_args(server, lex, arg, &zone, NULL, text, false);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(zone_from_args(server, lex, arg, &zone, NULL, text, false));
+
        if (zone == NULL) {
                return ISC_R_UNEXPECTEDEND;
        }
@@ -10154,17 +10053,15 @@ named_server_retransfercommand(named_server_t *server, isc_lex_t *lex,
 isc_result_t
 named_server_reloadcommand(named_server_t *server, isc_lex_t *lex,
                           isc_buffer_t *text) {
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        dns_zone_t *zone = NULL;
        dns_zonetype_t type;
        const char *msg = NULL;
 
        REQUIRE(text != NULL);
 
-       result = zone_from_args(server, lex, NULL, &zone, NULL, text, true);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(zone_from_args(server, lex, NULL, &zone, NULL, text, true));
+
        if (zone == NULL) {
                result = reload(server);
                switch (result) {
@@ -10317,16 +10214,13 @@ cleanup:
 isc_result_t
 named_server_notifycommand(named_server_t *server, isc_lex_t *lex,
                           isc_buffer_t *text) {
-       isc_result_t result;
        dns_zone_t *zone = NULL;
        const char msg[] = "zone notify queued";
 
        REQUIRE(text != NULL);
 
-       result = zone_from_args(server, lex, NULL, &zone, NULL, text, true);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(zone_from_args(server, lex, NULL, &zone, NULL, text, true));
+
        if (zone == NULL) {
                return ISC_R_UNEXPECTEDEND;
        }
@@ -10345,7 +10239,6 @@ named_server_notifycommand(named_server_t *server, isc_lex_t *lex,
 isc_result_t
 named_server_refreshcommand(named_server_t *server, isc_lex_t *lex,
                            isc_buffer_t *text) {
-       isc_result_t result;
        dns_zone_t *zone = NULL, *raw = NULL;
        const char msg1[] = "zone refresh queued";
        const char msg2[] = "not a secondary, mirror, or stub zone";
@@ -10353,10 +10246,8 @@ named_server_refreshcommand(named_server_t *server, isc_lex_t *lex,
 
        REQUIRE(text != NULL);
 
-       result = zone_from_args(server, lex, NULL, &zone, NULL, text, true);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(zone_from_args(server, lex, NULL, &zone, NULL, text, true));
+
        if (zone == NULL) {
                return ISC_R_UNEXPECTEDEND;
        }
@@ -10431,15 +10322,12 @@ listenlist_fromconfig(const cfg_obj_t *listenlist, const cfg_obj_t *config,
                      cfg_aclconfctx_t *aclctx, isc_mem_t *mctx,
                      uint16_t family, isc_tlsctx_cache_t *tlsctx_cache,
                      ns_listenlist_t **target) {
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        ns_listenlist_t *dlist = NULL;
 
        REQUIRE(target != NULL && *target == NULL);
 
-       result = ns_listenlist_create(mctx, &dlist);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(ns_listenlist_create(mctx, &dlist));
 
        CFG_LIST_FOREACH(listenlist, element) {
                ns_listenelt_t *delt = NULL;
@@ -10490,7 +10378,7 @@ listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config,
                     cfg_aclconfctx_t *aclctx, isc_mem_t *mctx, uint16_t family,
                     isc_tlsctx_cache_t *tlsctx_cache,
                     ns_listenelt_t **target) {
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        const cfg_obj_t *ltup = NULL;
        const cfg_obj_t *tlsobj = NULL, *httpobj = NULL;
        const cfg_obj_t *portobj = NULL;
@@ -10653,41 +10541,29 @@ listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config,
                        if (named_g_httpsport != 0) {
                                port = named_g_httpsport;
                        } else {
-                               result = named_config_getport(
-                                       config, "https-port", &port);
-                               if (result != ISC_R_SUCCESS) {
-                                       return result;
-                               }
+                               RETERR(named_config_getport(
+                                       config, "https-port", &port));
                        }
                } else if (http && !do_tls) {
                        if (named_g_httpport != 0) {
                                port = named_g_httpport;
                        } else {
-                               result = named_config_getport(
-                                       config, "http-port", &port);
-                               if (result != ISC_R_SUCCESS) {
-                                       return result;
-                               }
+                               RETERR(named_config_getport(config, "http-port",
+                                                           &port));
                        }
                } else if (do_tls) {
                        if (named_g_tlsport != 0) {
                                port = named_g_tlsport;
                        } else {
-                               result = named_config_getport(
-                                       config, "tls-port", &port);
-                               if (result != ISC_R_SUCCESS) {
-                                       return result;
-                               }
+                               RETERR(named_config_getport(config, "tls-port",
+                                                           &port));
                        }
                } else {
                        if (named_g_port != 0) {
                                port = named_g_port;
                        } else {
-                               result = named_config_getport(config, "port",
-                                                             &port);
-                               if (result != ISC_R_SUCCESS) {
-                                       return result;
-                               }
+                               RETERR(named_config_getport(config, "port",
+                                                           &port));
                        }
                }
        } else {
@@ -11562,11 +11438,11 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex) {
 
 isc_result_t
 named_server_flushnode(named_server_t *server, isc_lex_t *lex, bool tree) {
-       char *ptr, *viewname;
+       char *ptr = NULL, *viewname = NULL;
        char target[DNS_NAME_FORMATSIZE];
        bool flushed;
        bool found;
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        isc_buffer_t b;
        dns_fixedname_t fixed;
        dns_name_t *name = NULL;
@@ -11587,10 +11463,7 @@ named_server_flushnode(named_server_t *server, isc_lex_t *lex, bool tree) {
        isc_buffer_constinit(&b, target, strlen(target));
        isc_buffer_add(&b, strlen(target));
        name = dns_fixedname_initname(&fixed);
-       result = dns_name_fromtext(name, &b, dns_rootname, 0);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromtext(name, &b, dns_rootname, 0));
 
        /* Look for the view name. */
        viewname = next_token(lex, NULL);
@@ -11834,11 +11707,11 @@ cleanup:
  */
 isc_result_t
 named_server_rekey(named_server_t *server, isc_lex_t *lex, isc_buffer_t *text) {
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        dns_zone_t *zone = NULL;
        dns_zonetype_t type;
        bool fullsign = false;
-       char *ptr;
+       char *ptr = NULL;
 
        REQUIRE(text != NULL);
 
@@ -11853,10 +11726,8 @@ named_server_rekey(named_server_t *server, isc_lex_t *lex, isc_buffer_t *text) {
 
        REQUIRE(text != NULL);
 
-       result = zone_from_args(server, lex, NULL, &zone, NULL, text, false);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(zone_from_args(server, lex, NULL, &zone, NULL, text, false));
+
        if (zone == NULL) {
                return ISC_R_UNEXPECTEDEND; /* XXX: or do all zones? */
        }
@@ -11912,7 +11783,7 @@ synczone(dns_zone_t *zone, void *uap) {
 
 isc_result_t
 named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t *text) {
-       isc_result_t result, tresult;
+       isc_result_t result = ISC_R_SUCCESS, tresult;
        dns_zone_t *zone = NULL;
        char classstr[DNS_RDATACLASS_FORMATSIZE];
        char zonename[DNS_NAME_FORMATSIZE];
@@ -11933,10 +11804,7 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t *text) {
 
        REQUIRE(text != NULL);
 
-       result = zone_from_args(server, lex, arg, &zone, NULL, text, false);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(zone_from_args(server, lex, arg, &zone, NULL, text, false));
 
        if (zone == NULL) {
                isc_loopmgr_pause();
@@ -11989,7 +11857,7 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t *text) {
 isc_result_t
 named_server_freeze(named_server_t *server, bool freeze, isc_lex_t *lex,
                    isc_buffer_t *text) {
-       isc_result_t result, tresult;
+       isc_result_t result = ISC_R_SUCCESS;
        dns_zone_t *mayberaw = NULL, *raw = NULL;
        dns_zonetype_t type;
        char classstr[DNS_RDATACLASS_FORMATSIZE];
@@ -12000,26 +11868,24 @@ named_server_freeze(named_server_t *server, bool freeze, isc_lex_t *lex,
 
        REQUIRE(text != NULL);
 
-       result = zone_from_args(server, lex, NULL, &mayberaw, NULL, text, true);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(zone_from_args(server, lex, NULL, &mayberaw, NULL, text, true));
+
        if (mayberaw == NULL) {
+               isc_result_t tresult = ISC_R_SUCCESS;
                isc_loopmgr_pause();
-               tresult = ISC_R_SUCCESS;
                ISC_LIST_FOREACH(server->viewlist, view, link) {
-                       result = dns_view_freezezones(view, freeze);
-                       if (result != ISC_R_SUCCESS && tresult == ISC_R_SUCCESS)
+                       tresult = dns_view_freezezones(view, freeze);
+                       if (tresult != ISC_R_SUCCESS && result == ISC_R_SUCCESS)
                        {
-                               tresult = result;
+                               result = tresult;
                        }
                }
                isc_loopmgr_resume();
                isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
                              ISC_LOG_INFO, "%s all zones: %s",
                              freeze ? "freezing" : "thawing",
-                             isc_result_totext(tresult));
-               return tresult;
+                             isc_result_totext(result));
+               return result;
        }
        dns_zone_getraw(mayberaw, &raw);
        if (raw != NULL) {
index f557ec751429e1bdcba3332967745ba729eb5141..bd29d8fab5375b6def3d9ea5f94a76d43802cc2f 100644 (file)
@@ -71,7 +71,6 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
                   cfg_aclconfctx_t *aclctx, dns_zone_t *zone,
                   void (*setzacl)(dns_zone_t *, dns_acl_t *),
                   void (*clearzacl)(dns_zone_t *)) {
-       isc_result_t result;
        const cfg_obj_t *maps[6] = { 0 };
        const cfg_obj_t *aclobj = NULL;
        int i = 0;
@@ -169,11 +168,7 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
        }
 
 parse_acl:
-       result = cfg_acl_fromconfig(aclobj, config, aclctx, isc_g_mctx, 0,
-                                   &acl);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(cfg_acl_fromconfig(aclobj, config, aclctx, isc_g_mctx, 0, &acl));
        (*setzacl)(zone, acl);
 
        /* Set the view default now */
@@ -558,12 +553,9 @@ configure_staticstub(const cfg_obj_t *zconfig, const cfg_obj_t *tconfig,
        isc_region_t region;
 
        /* Create the DB beforehand */
-       result = dns_db_create(mctx, dbtype, dns_zone_getorigin(zone),
-                              dns_dbtype_stub, dns_zone_getclass(zone), 0,
-                              NULL, &db);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_create(mctx, dbtype, dns_zone_getorigin(zone),
+                            dns_dbtype_stub, dns_zone_getclass(zone), 0, NULL,
+                            &db));
 
        dns_rdataset_init(&rdataset);
 
@@ -694,8 +686,6 @@ zonetype_fromconfig(const cfg_obj_t *zmap, const cfg_obj_t *tmap) {
 static isc_result_t
 strtoargvsub(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp,
             unsigned int n) {
-       isc_result_t result;
-
        /* Discard leading whitespace. */
        while (*s == ' ' || *s == '\t') {
                s++;
@@ -714,10 +704,7 @@ strtoargvsub(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp,
                        *p++ = '\0';
                }
 
-               result = strtoargvsub(mctx, p, argcp, argvp, n + 1);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(strtoargvsub(mctx, p, argcp, argvp, n + 1));
                (*argvp)[n] = s;
        }
        return ISC_R_SUCCESS;
@@ -1917,10 +1904,7 @@ named_zone_configure_writeable_dlz(dns_dlzdb_t *dlzdatabase, dns_zone_t *zone,
        isc_result_t result;
 
        dns_zone_settype(zone, dns_zone_dlz);
-       result = dns_sdlz_setdb(dlzdatabase, rdclass, name, &db);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_sdlz_setdb(dlzdatabase, rdclass, name, &db));
        result = dns_zone_dlzpostload(zone, db);
        dns_db_detach(&db);
        return result;
index 3fdd7633f60b9b9c35b3cafc459e6c2d8038742a..8dc3e257b120e1d7e0c6f9d0928a5e50acb5dd09 100644 (file)
@@ -62,7 +62,6 @@ synthrecord_reverseanswer(synthrecord_t *inst, isc_netaddr_t *na,
        isc_buffer_t addrb;
        char addrbdata[DNS_NAME_FORMATSIZE];
        isc_region_t addrr;
-       isc_result_t result;
 
        REQUIRE(DNS_NAME_VALID(synthname));
        REQUIRE(na->family == AF_INET || na->family == AF_INET6);
@@ -71,10 +70,7 @@ synthrecord_reverseanswer(synthrecord_t *inst, isc_netaddr_t *na,
        isc_buffer_copyregion(&b, &inst->prefix);
 
        isc_buffer_init(&addrb, addrbdata, sizeof(addrbdata));
-       result = isc_netaddr_totext(na, &addrb);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_netaddr_totext(na, &addrb));
 
        /*
         * IDN compatibility, as an IPv6 begining or ending with `::` will be
@@ -468,11 +464,8 @@ synthrecord_initorigin(synthrecord_t *inst, const cfg_obj_t *synthrecordcfg,
        dns_name_init(&inst->origin);
        if (result == ISC_R_SUCCESS) {
                originstr = cfg_obj_asstring(obj);
-               result = dns_name_fromstring(&inst->origin, originstr, NULL, 0,
-                                            inst->mctx);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_name_fromstring(&inst->origin, originstr, NULL, 0,
+                                          inst->mctx));
 
                if (!dns_name_isabsolute(&inst->origin)) {
                        isc_log_write(NS_LOGCATEGORY_GENERAL,
@@ -517,11 +510,8 @@ synthrecord_parseallowsynth(synthrecord_t *inst, const cfg_obj_t *cfg,
                return result;
        }
 
-       result = cfg_acl_fromconfig(obj, cfg, aclctx, inst->mctx, 0,
-                                   &inst->allowedsynth);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(cfg_acl_fromconfig(obj, cfg, aclctx, inst->mctx, 0,
+                                 &inst->allowedsynth));
 
        for (unsigned int i = 0; i < inst->allowedsynth->length; i++) {
                switch (inst->allowedsynth->elements[i].type) {
index 47ab393e7368e47d239854b353fa38bc33edf794..34a64c8c8a35c77700ca67de84717e70d3163a63 100644 (file)
@@ -502,10 +502,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
                loginfo("dlz_example: lookup connection from %s", buf);
 
                found = true;
-               result = state->putrr(lookup, "TXT", 0, buf);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(state->putrr(lookup, "TXT", 0, buf));
        }
 
        if (strcmp(name, "too-long") == 0 ||
@@ -516,10 +513,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
                }
                buf[i] = '\0';
                found = true;
-               result = state->putrr(lookup, "TXT", 0, buf);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(state->putrr(lookup, "TXT", 0, buf));
        }
 
        /* Tests for DLZ redirection zones */
@@ -545,12 +539,9 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
        for (i = 0; i < MAX_RECORDS; i++) {
                if (strcasecmp(state->current[i].name, full_name) == 0) {
                        found = true;
-                       result = state->putrr(lookup, state->current[i].type,
-                                             state->current[i].ttl,
-                                             state->current[i].data);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(state->putrr(lookup, state->current[i].type,
+                                           state->current[i].ttl,
+                                           state->current[i].data));
                }
        }
 
@@ -616,17 +607,13 @@ dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
        }
 
        for (i = 0; i < MAX_RECORDS; i++) {
-               isc_result_t result;
                if (strlen(state->current[i].name) == 0U) {
                        continue;
                }
-               result = state->putnamedrr(allnodes, state->current[i].name,
-                                          state->current[i].type,
-                                          state->current[i].ttl,
-                                          state->current[i].data);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(state->putnamedrr(allnodes, state->current[i].name,
+                                        state->current[i].type,
+                                        state->current[i].ttl,
+                                        state->current[i].data));
        }
 
        return ISC_R_SUCCESS;
index 3cdbd34df697be943a89ce53ed53b72a07b86058..52cea705170ca22835e7642bc86ee5358b6214ec 100644 (file)
@@ -45,20 +45,11 @@ static isc_result_t
 loadzone(dns_db_t **db, const char *origin, const char *filename) {
        isc_result_t result;
        dns_fixedname_t fixed;
-       dns_name_t *name = NULL;
+       dns_name_t *name = dns_fixedname_initname(&fixed);
 
-       name = dns_fixedname_initname(&fixed);
-
-       result = dns_name_fromstring(name, origin, dns_rootname, 0, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = dns_db_create(isc_g_mctx, ZONEDB_DEFAULT, name,
-                              dns_dbtype_zone, dns_rdataclass_in, 0, NULL, db);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromstring(name, origin, dns_rootname, 0, NULL));
+       RETERR(dns_db_create(isc_g_mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
+                            dns_rdataclass_in, 0, NULL, db));
 
        result = dns_db_load(*db, filename, dns_masterformat_text, 0);
        if (result == DNS_R_SEENINCLUDE) {
index d0a65a62d1e4a3625b28d079a7f849e57144aad5..9c9faa35354006828be0eadf0e25ad79526f2fe8 100644 (file)
@@ -271,7 +271,6 @@ dns_acl_match_port_transport(const isc_netaddr_t *reqaddr,
  */
 isc_result_t
 dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, bool pos) {
-       isc_result_t result;
        unsigned int nelem, i;
        int max_node = 0, nodes;
 
@@ -345,10 +344,7 @@ dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, bool pos) {
         * node_count value is set correctly afterward.
         */
        nodes = max_node + dns_acl_node_count(dest);
-       result = dns_iptable_merge(dest->iptable, source->iptable, pos);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_iptable_merge(dest->iptable, source->iptable, pos));
        if (nodes > dns_acl_node_count(dest)) {
                dns_acl_node_count(dest) = nodes;
        }
index af36a8f878a3fee5f3ad1d56cf4af34ac118d9f9..467caa2662716cc06dd293ad51ffa57c42a3e6c8 100644 (file)
@@ -2351,12 +2351,7 @@ print_find_list(FILE *f, dns_adbname_t *name) {
 
 static isc_result_t
 putstr(isc_buffer_t *b, const char *str) {
-       isc_result_t result;
-
-       result = isc_buffer_reserve(b, strlen(str));
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_buffer_reserve(b, strlen(str)));
 
        isc_buffer_putstr(b, str);
        return ISC_R_SUCCESS;
index f93f7255106a5b2c761cdddcc441131eb8431eec..e9c904eda0033c58f34df6921704bf02aaa31434 100644 (file)
@@ -323,15 +323,11 @@ dns_cache_getservestalerefresh(dns_cache_t *cache) {
 
 isc_result_t
 dns_cache_flush(dns_cache_t *cache) {
-       dns_db_t *db = NULL, *olddb;
-       isc_mem_t *tmctx = NULL, *oldtmctx;
-       isc_mem_t *hmctx = NULL, *oldhmctx;
-       isc_result_t result;
+       dns_db_t *db = NULL, *olddb = NULL;
+       isc_mem_t *tmctx = NULL, *oldtmctx = NULL;
+       isc_mem_t *hmctx = NULL, *oldhmctx = NULL;
 
-       result = cache_create_db(cache, &db, &tmctx, &hmctx);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(cache_create_db(cache, &db, &tmctx, &hmctx));
 
        LOCK(&cache->lock);
        isc_mem_clearwater(cache->tmctx);
@@ -353,16 +349,13 @@ dns_cache_flush(dns_cache_t *cache) {
 
 static isc_result_t
 clearnode(dns_db_t *db, dns_dbnode_t *node) {
-       isc_result_t result;
        dns_rdatasetiter_t *iter = NULL;
 
-       result = dns_db_allrdatasets(db, node, NULL, DNS_DB_STALEOK,
-                                    (isc_stdtime_t)0, &iter);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_allrdatasets(db, node, NULL, DNS_DB_STALEOK,
+                                  (isc_stdtime_t)0, &iter));
 
        DNS_RDATASETITER_FOREACH(iter) {
+               isc_result_t result;
                dns_rdataset_t rdataset = DNS_RDATASET_INIT;
 
                dns_rdatasetiter_current(iter, &rdataset);
@@ -375,7 +368,7 @@ clearnode(dns_db_t *db, dns_dbnode_t *node) {
        }
 
        dns_rdatasetiter_destroy(&iter);
-       return result;
+       return ISC_R_SUCCESS;
 }
 
 static isc_result_t
index fb7b284dcb5ad45928ec294851d7a8e726be048d..44f2757c290ef74a4f9e751796e558b2e47803b8 100644 (file)
@@ -1200,18 +1200,12 @@ catz_process_coo(dns_catz_zone_t *catz, dns_label_t *mhash,
                return ISC_R_FAILURE;
        }
 
-       result = dns_rdataset_first(value);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdataset_first(value));
 
        dns_rdata_init(&rdata);
        dns_rdataset_current(value, &rdata);
 
-       result = dns_rdata_tostruct(&rdata, &ptr, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdata_tostruct(&rdata, &ptr, NULL));
 
        if (dns_name_countlabels(&ptr.ptr) == 0) {
                CHECK(ISC_R_FAILURE);
@@ -1253,18 +1247,12 @@ catz_process_zones_entry(dns_catz_zone_t *catz, dns_rdataset_t *value,
                return ISC_R_FAILURE;
        }
 
-       result = dns_rdataset_first(value);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdataset_first(value));
 
        dns_rdata_init(&rdata);
        dns_rdataset_current(value, &rdata);
 
-       result = dns_rdata_tostruct(&rdata, &ptr, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdata_tostruct(&rdata, &ptr, NULL));
 
        result = isc_ht_find(catz->entries, mhash->base, mhash->length,
                             (void **)&entry);
@@ -1314,18 +1302,12 @@ catz_process_version(dns_catz_zone_t *catz, dns_rdataset_t *value) {
                return ISC_R_FAILURE;
        }
 
-       result = dns_rdataset_first(value);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdataset_first(value));
 
        dns_rdata_init(&rdata);
        dns_rdataset_current(value, &rdata);
 
-       result = dns_rdata_tostruct(&rdata, &rdatatxt, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdata_tostruct(&rdata, &rdatatxt, NULL));
 
        CHECK(dns_rdata_txt_first(&rdatatxt));
 
@@ -1559,10 +1541,7 @@ catz_process_apl(dns_catz_zone_t *catz, isc_buffer_t **aclbp,
        RUNTIME_CHECK(result == ISC_R_SUCCESS);
        dns_rdata_init(&rdata);
        dns_rdataset_current(value, &rdata);
-       result = dns_rdata_tostruct(&rdata, &rdata_apl, catz->catzs->mctx);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdata_tostruct(&rdata, &rdata_apl, catz->catzs->mctx));
        isc_buffer_allocate(catz->catzs->mctx, &aclb, 16);
        for (result = dns_rdata_apl_first(&rdata_apl); result == ISC_R_SUCCESS;
             result = dns_rdata_apl_next(&rdata_apl))
@@ -1802,10 +1781,7 @@ dns__catz_update_process(dns_catz_zone_t *catz, const dns_name_t *src_name,
        nrres = dns_name_fullcompare(src_name, &catz->name, &order, &nlabels);
        if (nrres == dns_namereln_equal) {
                if (rdataset->type == dns_rdatatype_soa) {
-                       result = dns_rdataset_first(rdataset);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(dns_rdataset_first(rdataset));
 
                        dns_rdataset_current(rdataset, &rdata);
                        result = dns_rdata_tostruct(&rdata, &soa, NULL);
index 2ab84644c9f65fa74bceae3ca9fd258fc5761767..80f505d02bb27e9d3d76cf05a2d1d8265021e2c5 100644 (file)
@@ -317,10 +317,7 @@ dns_db_load(dns_db_t *db, const char *filename, dns_masterformat_t format,
        }
 
        dns_rdatacallbacks_init(&callbacks);
-       result = dns_db_beginload(db, &callbacks);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_beginload(db, &callbacks));
        result = dns_master_loadfile(filename, &db->origin, &db->origin,
                                     db->rdclass, options, 0, &callbacks, NULL,
                                     NULL, db->mctx, format, 0);
@@ -697,10 +694,7 @@ dns_db_getsoaserial(dns_db_t *db, dns_dbversion_t *ver, uint32_t *serialp) {
 
        REQUIRE(dns_db_iszone(db) || dns_db_isstub(db));
 
-       result = dns_db_findnode(db, dns_db_origin(db), false, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_findnode(db, dns_db_origin(db), false, &node));
 
        dns_rdataset_init(&rdataset);
        result = dns_db_findrdataset(db, node, ver, dns_rdatatype_soa, 0,
index 3927ef1162dfb7257596d8861f3498be5d68daf4..67a27894d5fd73f36532c1fff6c2a2f0f99e260d 100644 (file)
@@ -1328,10 +1328,7 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *localaddr,
         */
        isc_sockaddr_anyofpf(&sa_any, isc_sockaddr_pf(localaddr));
        if (!isc_sockaddr_eqaddr(&sa_any, localaddr)) {
-               result = isc_nm_checkaddr(localaddr, isc_socktype_udp);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(isc_nm_checkaddr(localaddr, isc_socktype_udp));
        }
 
        dispatch_allocate(mgr, isc_socktype_udp, tid, &disp);
@@ -1978,15 +1975,9 @@ tcp_dispatch_connect(dns_dispatch_t *disp, dns_dispentry_t *resp) {
        }
 
        if (transport_type == DNS_TRANSPORT_TLS) {
-               isc_result_t result;
-
-               result = dns_transport_get_tlsctx(
-                       resp->transport, &resp->peer, resp->tlsctx_cache,
-                       resp->mctx, &tlsctx, &sess_cache);
-
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_transport_get_tlsctx(resp->transport, &resp->peer,
+                                               resp->tlsctx_cache, resp->mctx,
+                                               &tlsctx, &sess_cache));
                INSIST(tlsctx != NULL);
        }
 
index f13c06ec12fb4a74dcae3589bee78fc1fb0e7983..92c4399998907dc806f2e234c0223e36e77b1598 100644 (file)
@@ -131,7 +131,6 @@ dns_dns64_aaaafroma(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr,
                    const dns_name_t *reqsigner, dns_aclenv_t *env,
                    unsigned int flags, unsigned char *a, unsigned char *aaaa) {
        unsigned int nbytes, i;
-       isc_result_t result;
        int match;
 
        if ((dns64->flags & DNS_DNS64_RECURSIVE_ONLY) != 0 &&
@@ -147,11 +146,8 @@ dns_dns64_aaaafroma(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr,
        }
 
        if (dns64->clients != NULL && reqaddr != NULL) {
-               result = dns_acl_match(reqaddr, reqsigner, dns64->clients, env,
-                                      &match, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_acl_match(reqaddr, reqsigner, dns64->clients, env,
+                                    &match, NULL));
                if (match <= 0) {
                        return DNS_R_DISALLOWED;
                }
@@ -163,11 +159,8 @@ dns_dns64_aaaafroma(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr,
 
                memmove(&ina.s_addr, a, 4);
                isc_netaddr_fromin(&netaddr, &ina);
-               result = dns_acl_match(&netaddr, NULL, dns64->mapped, env,
-                                      &match, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_acl_match(&netaddr, NULL, dns64->mapped, env, &match,
+                                    NULL));
                if (match <= 0) {
                        return DNS_R_DISALLOWED;
                }
index 703366511de66e61b66f19fd3deb9a5269a0972a..f079dcc472ab2d589f71ddc89bcb54752c31f542 100644 (file)
@@ -145,17 +145,13 @@ static isc_result_t
 digest_sig(dst_context_t *ctx, bool downcase, dns_rdata_t *sigrdata,
           dns_rdata_rrsig_t *rrsig) {
        isc_region_t r;
-       isc_result_t ret;
        dns_fixedname_t fname;
 
        dns_rdata_toregion(sigrdata, &r);
        INSIST(r.length >= 19);
 
        r.length = 18;
-       ret = dst_context_adddata(ctx, &r);
-       if (ret != ISC_R_SUCCESS) {
-               return ret;
-       }
+       RETERR(dst_context_adddata(ctx, &r));
        if (downcase) {
                dns_fixedname_init(&fname);
 
@@ -225,10 +221,7 @@ dns_dnssec_sign(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
        sig.timesigned = *inception;
        sig.timeexpire = *expire;
        sig.keyid = dst_key_id(key);
-       ret = dst_key_sigsize(key, &sigsize);
-       if (ret != ISC_R_SUCCESS) {
-               return ret;
-       }
+       RETERR(dst_key_sigsize(key, &sigsize));
        sig.siglen = sigsize;
        /*
         * The actual contents of sig.signature are not important yet, since
@@ -368,10 +361,7 @@ dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
        REQUIRE(mctx != NULL);
        REQUIRE(sigrdata != NULL && sigrdata->type == dns_rdatatype_rrsig);
 
-       ret = dns_rdata_tostruct(sigrdata, &sig, NULL);
-       if (ret != ISC_R_SUCCESS) {
-               return ret;
-       }
+       RETERR(dns_rdata_tostruct(sigrdata, &sig, NULL));
 
        if (set->type != sig.covered) {
                return DNS_R_SIGINVALID;
@@ -1701,15 +1691,11 @@ cleanup:
 isc_result_t
 dns_dnssec_make_dnskey(dst_key_t *key, unsigned char *buf, int bufsize,
                       dns_rdata_t *target) {
-       isc_result_t result;
        isc_buffer_t b;
        isc_region_t r;
 
        isc_buffer_init(&b, buf, bufsize);
-       result = dst_key_todns(key, &b);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_todns(key, &b));
 
        dns_rdata_reset(target);
        isc_buffer_usedregion(&b, &r);
@@ -1851,16 +1837,12 @@ static isc_result_t
 delete_cds(dns_dnsseckey_t *key, dns_rdata_t *keyrdata, const char *keystr,
           dns_rdataset_t *cds, unsigned int digesttype, dns_diff_t *diff,
           isc_mem_t *mctx) {
-       isc_result_t r;
        unsigned char dsbuf[DNS_DS_BUFFERSIZE];
        dns_rdata_t cdsrdata = DNS_RDATA_INIT;
        dns_name_t *origin = dst_key_name(key->key);
 
-       r = dns_ds_buildrdata(origin, keyrdata, digesttype, dsbuf,
-                             sizeof(dsbuf), &cdsrdata);
-       if (r != ISC_R_SUCCESS) {
-               return r;
-       }
+       RETERR(dns_ds_buildrdata(origin, keyrdata, digesttype, dsbuf,
+                                sizeof(dsbuf), &cdsrdata));
 
        cdsrdata.type = dns_rdatatype_cds;
        if (exists(cds, &cdsrdata)) {
index 773a880127a0a1214ae1e6879cfceb8e19e1fdcd..e8c71a80c72b5fdc5108a8d6a08db1146e301e2f 100644 (file)
@@ -186,10 +186,7 @@ dns_ds_buildrdata(dns_name_t *owner, dns_rdata_t *key,
        dns_rdata_ds_t ds;
        isc_buffer_t b;
 
-       result = dns_ds_fromkeyrdata(owner, key, digest_type, digest, len, &ds);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_ds_fromkeyrdata(owner, key, digest_type, digest, len, &ds));
 
        memset(buffer, 0, DNS_DS_BUFFERSIZE);
        isc_buffer_init(&b, buffer, DNS_DS_BUFFERSIZE);
index 3f9743e3b2d3aea14c6fe6f284161cfe30504557..4b79f487aedb8c72fb7a0e7f1d5fa66609ef8d58 100644 (file)
@@ -675,7 +675,6 @@ dst_key_fromdns(const dns_name_t *name, dns_rdataclass_t rdclass,
        dst_key_t *key = NULL;
        dns_keytag_t id, rid;
        isc_region_t r;
-       isc_result_t result;
 
        isc_buffer_remainingregion(source, &r);
 
@@ -697,11 +696,8 @@ dst_key_fromdns(const dns_name_t *name, dns_rdataclass_t rdclass,
                flags |= (extflags << 16);
        }
 
-       result = frombuffer(name, alg, flags, proto, rdclass, source, mctx,
-                           &key);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(frombuffer(name, alg, flags, proto, rdclass, source, mctx,
+                         &key));
        key->key_id = id;
        key->key_rid = rid;
 
@@ -716,11 +712,8 @@ dst_key_frombuffer(const dns_name_t *name, unsigned int alg, unsigned int flags,
        dst_key_t *key = NULL;
        isc_result_t result;
 
-       result = frombuffer(name, alg, flags, protocol, rdclass, source, mctx,
-                           &key);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(frombuffer(name, alg, flags, protocol, rdclass, source, mctx,
+                         &key));
 
        result = computeid(key);
        if (result != ISC_R_SUCCESS) {
@@ -1900,17 +1893,10 @@ write_key_state(const dst_key_t *key, int type, const char *directory) {
         * Make the filename.
         */
        isc_buffer_init(&fileb, filename, sizeof(filename));
-       result = dst_key_buildfilename(key, DST_TYPE_STATE, directory, &fileb);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_buildfilename(key, DST_TYPE_STATE, directory, &fileb));
 
        isc_buffer_init(&tmpb, tmpname, sizeof(tmpname));
-       result = dst_key_buildfilename(key, DST_TYPE_TEMPLATE, directory,
-                                      &tmpb);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_buildfilename(key, DST_TYPE_TEMPLATE, directory, &tmpb));
 
        mode_t mode = issymmetric(key) ? S_IRUSR | S_IWUSR
                                       : S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
@@ -1993,10 +1979,7 @@ write_public_key(const dst_key_t *key, int type, const char *directory) {
        isc_buffer_init(&textb, text_array, sizeof(text_array));
        isc_buffer_init(&classb, class_array, sizeof(class_array));
 
-       result = dst_key_todns(key, &keyb);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_todns(key, &keyb));
 
        isc_buffer_usedregion(&keyb, &r);
        dns_rdata_fromregion(&rdata, key->key_class, dns_rdatatype_dnskey, &r);
@@ -2015,17 +1998,10 @@ write_public_key(const dst_key_t *key, int type, const char *directory) {
         * Make the filename.
         */
        isc_buffer_init(&fileb, filename, sizeof(filename));
-       result = dst_key_buildfilename(key, DST_TYPE_PUBLIC, directory, &fileb);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_buildfilename(key, DST_TYPE_PUBLIC, directory, &fileb));
 
        isc_buffer_init(&tmpb, tmpname, sizeof(tmpname));
-       result = dst_key_buildfilename(key, DST_TYPE_TEMPLATE, directory,
-                                      &tmpb);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_buildfilename(key, DST_TYPE_TEMPLATE, directory, &tmpb));
 
        /* Create temporary public key file. */
        mode_t mode = issymmetric(key) ? S_IRUSR | S_IWUSR
@@ -2096,7 +2072,6 @@ static isc_result_t
 buildfilename(dns_name_t *name, dns_keytag_t id, unsigned int alg,
              unsigned int type, const char *directory, isc_buffer_t *out) {
        const char *suffix = "";
-       isc_result_t result;
 
        REQUIRE(out != NULL);
        REQUIRE(alg != 0 && alg != DST_ALG_PRIVATEOID &&
@@ -2127,10 +2102,7 @@ buildfilename(dns_name_t *name, dns_keytag_t id, unsigned int alg,
                return ISC_R_NOSPACE;
        }
        isc_buffer_putstr(out, "K");
-       result = dns_name_tofilenametext(name, false, out);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_tofilenametext(name, false, out));
 
        return isc_buffer_printf(out, "+%03d+%05d%s", alg, id, suffix);
 }
index 0310f3be797d39b79afee831471cadb315534738..8622a3b129404a93d14c70eaf416a4b048c5f39f 100644 (file)
@@ -619,11 +619,7 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv,
        }
 
        isc_buffer_init(&fileb, filename, sizeof(filename));
-       result = dst_key_buildfilename(key, DST_TYPE_PRIVATE, directory,
-                                      &fileb);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_buildfilename(key, DST_TYPE_PRIVATE, directory, &fileb));
 
        result = isc_file_mode(filename, &mode);
        if (result == ISC_R_SUCCESS && mode != (S_IRUSR | S_IWUSR)) {
@@ -640,11 +636,7 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv,
        }
 
        isc_buffer_init(&tmpb, tmpname, sizeof(tmpname));
-       result = dst_key_buildfilename(key, DST_TYPE_TEMPLATE, directory,
-                                      &tmpb);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_buildfilename(key, DST_TYPE_TEMPLATE, directory, &tmpb));
 
        fp = dst_key_open(tmpname, S_IRUSR | S_IWUSR);
        if (fp == NULL) {
index c84ce8efc175491d2f6eef28380b95665c62befb..1a9a1631911218835849879bcb350f05ef736c35 100644 (file)
@@ -456,18 +456,15 @@ static isc_result_t
 hmac_parse(const isc_md_type_t *type, dst_key_t *key, isc_lex_t *lexer,
           dst_key_t *pub) {
        dst_private_t priv;
-       isc_result_t result, tresult;
+       isc_result_t result = ISC_R_SUCCESS, tresult;
        isc_buffer_t b;
        isc_mem_t *mctx = key->mctx;
        unsigned int i;
 
        UNUSED(pub);
        /* read private key file */
-       result = dst__privstruct_parse(key, hmac__to_dst_alg(type), lexer, mctx,
-                                      &priv);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst__privstruct_parse(key, hmac__to_dst_alg(type), lexer, mctx,
+                                    &priv));
 
        if (key->external) {
                result = DST_R_EXTERNALKEY;
index c405ce54cd166ad042eafd2895b349a33b1e6b9f..3b2884dded358bdcc5b87d454dc854a5da444ee8 100644 (file)
@@ -90,17 +90,12 @@ dns_iptable_addprefix(dns_iptable_t *tab, const isc_netaddr_t *addr,
  */
 isc_result_t
 dns_iptable_merge(dns_iptable_t *tab, dns_iptable_t *source, bool pos) {
-       isc_result_t result;
        isc_radix_node_t *node, *new_node;
        int i, max_node = 0;
 
        RADIX_WALK(source->radix->head, node) {
                new_node = NULL;
-               result = isc_radix_insert(tab->radix, &new_node, node, NULL);
-
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(isc_radix_insert(tab->radix, &new_node, node, NULL));
 
                /*
                 * If we're negating a nested ACL, then we should
index 9c969a4a0af291a79eb588845576adf80eb68a34..46dff831bd71a034e0088415810caf53caadf37b 100644 (file)
@@ -460,17 +460,12 @@ journal_fsync(dns_journal_t *j) {
  */
 static isc_result_t
 journal_read_xhdr(dns_journal_t *j, journal_xhdr_t *xhdr) {
-       isc_result_t result;
-
        j->it.cpos.offset = j->offset;
 
        switch (j->xhdr_version) {
        case XHDR_VERSION1: {
                journal_rawxhdr_ver1_t raw;
-               result = journal_read(j, &raw, sizeof(raw));
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(journal_read(j, &raw, sizeof(raw)));
                xhdr->size = decode_uint32(raw.size);
                xhdr->count = 0;
                xhdr->serial0 = decode_uint32(raw.serial0);
@@ -481,10 +476,7 @@ journal_read_xhdr(dns_journal_t *j, journal_xhdr_t *xhdr) {
 
        case XHDR_VERSION2: {
                journal_rawxhdr_t raw;
-               result = journal_read(j, &raw, sizeof(raw));
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(journal_read(j, &raw, sizeof(raw)));
                xhdr->size = decode_uint32(raw.size);
                xhdr->count = decode_uint32(raw.count);
                xhdr->serial0 = decode_uint32(raw.serial0);
@@ -524,12 +516,8 @@ journal_write_xhdr(dns_journal_t *j, uint32_t size, uint32_t count,
 static isc_result_t
 journal_read_rrhdr(dns_journal_t *j, journal_rrhdr_t *rrhdr) {
        journal_rawrrhdr_t raw;
-       isc_result_t result;
 
-       result = journal_read(j, &raw, sizeof(raw));
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(journal_read(j, &raw, sizeof(raw)));
        rrhdr->size = decode_uint32(raw.size);
        return ISC_R_SUCCESS;
 }
@@ -929,10 +917,7 @@ journal_next(dns_journal_t *j, journal_pos_t *pos) {
 
        REQUIRE(DNS_JOURNAL_VALID(j));
 
-       result = journal_seek(j, pos->offset);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(journal_seek(j, pos->offset));
 
        if (pos->serial == j->header.end.serial) {
                return ISC_R_NOMORE;
@@ -942,10 +927,7 @@ journal_next(dns_journal_t *j, journal_pos_t *pos) {
         * Read the header of the current transaction.
         * This will return ISC_R_NOMORE if we are at EOF.
         */
-       result = journal_read_xhdr(j, &xhdr);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(journal_read_xhdr(j, &xhdr));
 
        if (j->header_ver1) {
                CHECK(maybe_fixup_xhdr(j, &xhdr, pos->serial, pos->offset));
@@ -1096,7 +1078,6 @@ index_invalidate(dns_journal_t *j, uint32_t serial) {
  */
 static isc_result_t
 journal_find(dns_journal_t *j, uint32_t serial, journal_pos_t *pos) {
-       isc_result_t result;
        journal_pos_t current_pos;
 
        REQUIRE(DNS_JOURNAL_VALID(j));
@@ -1119,10 +1100,7 @@ journal_find(dns_journal_t *j, uint32_t serial, journal_pos_t *pos) {
                if (DNS_SERIAL_GT(current_pos.serial, serial)) {
                        return ISC_R_NOTFOUND;
                }
-               result = journal_next(j, &current_pos);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(journal_next(j, &current_pos));
        }
        *pos = current_pos;
        return ISC_R_SUCCESS;
@@ -2111,10 +2089,7 @@ get_name_diff(dns_db_t *db, dns_dbversion_t *ver, isc_stdtime_t now,
        dns_rdatasetiter_t *rdsiter = NULL;
        dns_difftuple_t *tuple = NULL;
 
-       result = dns_dbiterator_current(dbit, &node, name);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_dbiterator_current(dbit, &node, name));
 
        result = dns_db_allrdatasets(db, node, ver, 0, now, &rdsiter);
        if (result != ISC_R_SUCCESS) {
@@ -2250,10 +2225,7 @@ diff_namespace(dns_db_t *dba, dns_dbversion_t *dbvera, dns_db_t *dbb,
        dns_fixedname_init(&fixname[0]);
        dns_fixedname_init(&fixname[1]);
 
-       result = dns_db_createiterator(db[0], options, &dbit[0]);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_createiterator(db[0], options, &dbit[0]));
        result = dns_db_createiterator(db[1], options, &dbit[1]);
        if (result != ISC_R_SUCCESS) {
                goto cleanup_iterator;
@@ -2363,11 +2335,8 @@ dns_db_diffx(dns_diff_t *diff, dns_db_t *dba, dns_dbversion_t *dbvera,
        dns_journal_t *journal = NULL;
 
        if (filename != NULL) {
-               result = dns_journal_open(diff->mctx, filename,
-                                         DNS_JOURNAL_CREATE, &journal);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_journal_open(diff->mctx, filename,
+                                       DNS_JOURNAL_CREATE, &journal));
        }
 
        CHECK(diff_namespace(dba, dbvera, dbb, dbverb, DNS_DB_NONSEC3, diff));
index ff05486f16dcd2eb08f5817522d5b176d70ace75..a08846e37e5b0e9331f7feafa5b277b4c4522cc3 100644 (file)
@@ -134,7 +134,6 @@ buildpkcs11label(const char *uri, const dns_name_t *zname, const char *policy,
        bool ksk = ((flags & DNS_KEYFLAG_KSK) != 0);
        char timebuf[18];
        isc_time_t now = isc_time_now();
-       isc_result_t result;
        dns_fixedname_t fname;
        dns_name_t *pname = dns_fixedname_initname(&fname);
 
@@ -146,10 +145,7 @@ buildpkcs11label(const char *uri, const dns_name_t *zname, const char *policy,
        isc_buffer_putstr(buf, uri);
        isc_buffer_putstr(buf, ";object=");
        /* zone name */
-       result = dns_name_tofilenametext(zname, false, buf);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_tofilenametext(zname, false, buf));
        /*
         * policy name
         *
@@ -161,14 +157,8 @@ buildpkcs11label(const char *uri, const dns_name_t *zname, const char *policy,
                return ISC_R_NOSPACE;
        }
        isc_buffer_putstr(buf, "-");
-       result = dns_name_fromstring(pname, policy, dns_rootname, 0, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-       result = dns_name_tofilenametext(pname, false, buf);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromstring(pname, policy, dns_rootname, 0, NULL));
+       RETERR(dns_name_tofilenametext(pname, false, buf));
        /* key type + current time */
        isc_time_formatshorttimestamp(&now, timebuf, sizeof(timebuf));
        return isc_buffer_printf(buf, "-%s-%s", ksk ? "ksk" : "zsk", timebuf);
index 67523178ea59a1ce445ddc8ff22c3313c3f2f671..1c04b951320cf908831095e4b0b96c96d7b5baf3 100644 (file)
@@ -558,12 +558,7 @@ dns_keytable_issecuredomain(dns_keytable_t *keytable, const dns_name_t *name,
 
 static isc_result_t
 putstr(isc_buffer_t *b, const char *str) {
-       isc_result_t result;
-
-       result = isc_buffer_reserve(b, strlen(str));
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_buffer_reserve(b, strlen(str)));
 
        isc_buffer_putstr(b, str);
        return ISC_R_SUCCESS;
index f42c0c1ec187f2b0545dd86e49f5777e5ce758ac..d6fe9dfe76b8abf99de7fae4ba77725a3b41fb39 100644 (file)
@@ -2204,17 +2204,12 @@ cleanup:
 static isc_result_t
 read_and_check(bool do_read, isc_buffer_t *buffer, size_t len, FILE *f,
               uint32_t *totallen) {
-       isc_result_t result;
-
        REQUIRE(totallen != NULL);
 
        if (do_read) {
                INSIST(isc_buffer_availablelength(buffer) >= len);
-               result = isc_stdio_read(isc_buffer_used(buffer), 1, len, f,
-                                       NULL);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(isc_stdio_read(isc_buffer_used(buffer), 1, len, f,
+                                     NULL));
                isc_buffer_add(buffer, (unsigned int)len);
                if (*totallen < len) {
                        return ISC_R_RANGE;
@@ -2336,10 +2331,7 @@ load_raw(dns_loadctx_t *lctx) {
        dctx = DNS_DECOMPRESS_NEVER;
 
        if (lctx->first) {
-               result = load_header(lctx);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(load_header(lctx));
        }
 
        ISC_LIST_INIT(head);
index ca5704204bd27f229f2b82b34de6a096d9773082..f80c40232ac643ca2f7c1a271157faa1ccf500ab 100644 (file)
@@ -645,11 +645,8 @@ rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
                        INDENT_TO(ttl_column);
                        if ((ctx->style.flags & DNS_STYLEFLAG_TTL_UNITS) != 0) {
                                length = target->used;
-                               result = dns_ttl_totext(rdataset->ttl, false,
-                                                       false, target);
-                               if (result != ISC_R_SUCCESS) {
-                                       return result;
-                               }
+                               RETERR(dns_ttl_totext(rdataset->ttl, false,
+                                                     false, target));
                                column += target->used - length;
                        } else {
                                length = snprintf(ttlbuf, sizeof(ttlbuf), "%u",
@@ -1740,17 +1737,13 @@ dns_master_dumptostreamasync(isc_mem_t *mctx, dns_db_t *db,
                             isc_loop_t *loop, dns_dumpdonefunc_t done,
                             void *done_arg, dns_dumpctx_t **dctxp) {
        dns_dumpctx_t *dctx = NULL;
-       isc_result_t result;
 
        REQUIRE(loop != NULL);
        REQUIRE(f != NULL);
        REQUIRE(done != NULL);
 
-       result = dumpctx_create(mctx, db, version, style, f, &dctx,
-                               dns_masterformat_text, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dumpctx_create(mctx, db, version, style, f, &dctx,
+                             dns_masterformat_text, NULL));
        dctx->done = done;
        dctx->done_arg = done_arg;
 
@@ -1768,11 +1761,8 @@ dns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
        dns_dumpctx_t *dctx = NULL;
        isc_result_t result;
 
-       result = dumpctx_create(mctx, db, version, style, f, &dctx, format,
-                               header);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dumpctx_create(mctx, db, version, style, f, &dctx, format,
+                             header));
 
        result = dumptostream(dctx);
        INSIST(result != DNS_R_CONTINUE);
@@ -1871,10 +1861,7 @@ dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
        char *tempname;
        dns_dumpctx_t *dctx = NULL;
 
-       result = opentmp(mctx, filename, &tempname, &f);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(opentmp(mctx, filename, &tempname, &f));
 
        CHECK(dumpctx_create(mctx, db, version, style, f, &dctx, format,
                             header));
index bd68f18a6fae80cff44e464655c64245c2d505c9..f1701c98c20a57dad19fd6bed238c80e0efa671e 100644 (file)
@@ -295,15 +295,13 @@ msgblock_free(isc_mem_t *mctx, dns_msgblock_t *block,
  * "current" buffer.  (which is always the last on the list, for our
  * uses)
  */
-static isc_result_t
+static void
 newbuffer(dns_message_t *msg, unsigned int size) {
-       isc_buffer_t *dynbuf;
+       isc_buffer_t *dynbuf = NULL;
 
-       dynbuf = NULL;
        isc_buffer_allocate(msg->mctx, &dynbuf, size);
 
        ISC_LIST_APPEND(msg->scratchpad, dynbuf, link);
-       return ISC_R_SUCCESS;
 }
 
 static isc_buffer_t *
@@ -849,11 +847,7 @@ getname(dns_name_t *name, isc_buffer_t *source, dns_message_t *msg,
                if (result == ISC_R_NOSPACE) {
                        tries++;
 
-                       result = newbuffer(msg, SCRATCHPAD_SIZE);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
-
+                       newbuffer(msg, SCRATCHPAD_SIZE);
                        scratch = currentbuffer(msg);
                        dns_name_reset(name);
                } else {
@@ -906,10 +900,7 @@ getrdata(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
                                trysize *= 2;
                        }
                        tries++;
-                       result = newbuffer(msg, trysize);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       newbuffer(msg, trysize);
 
                        scratch = currentbuffer(msg);
                } else {
@@ -2217,10 +2208,7 @@ dns_message_renderend(dns_message_t *msg) {
        if (msg->tsigkey != NULL) {
                dns_message_renderrelease(msg, msg->sig_reserved);
                msg->sig_reserved = 0;
-               result = dns_tsig_sign(msg);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_tsig_sign(msg));
                count = 0;
                result = renderset(msg->tsig, msg->tsigname, msg->id, msg->cctx,
                                   msg->buffer, msg->reserved, 0, &count);
@@ -2236,10 +2224,7 @@ dns_message_renderend(dns_message_t *msg) {
        if (msg->sig0key != NULL) {
                dns_message_renderrelease(msg, msg->sig_reserved);
                msg->sig_reserved = 0;
-               result = dns_dnssec_signmessage(msg, msg->sig0key);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_dnssec_signmessage(msg, msg->sig0key));
                count = 0;
                /*
                 * Note: dns_rootname is used here, not msg->sig0name, since
@@ -2648,10 +2633,7 @@ dns_message_setopt(dns_message_t *msg) {
        REQUIRE(msg->from_to_wire == DNS_MESSAGE_INTENTRENDER);
        REQUIRE(msg->state == DNS_SECTION_ANY);
 
-       result = buildopt(msg, &opt);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(buildopt(msg, &opt));
 
        msgresetopt(msg);
 
@@ -2766,7 +2748,6 @@ dns_message_setquerytsig(dns_message_t *msg, isc_buffer_t *querytsig) {
 isc_result_t
 dns_message_getquerytsig(dns_message_t *msg, isc_mem_t *mctx,
                         isc_buffer_t **querytsig) {
-       isc_result_t result;
        dns_rdata_t rdata = DNS_RDATA_INIT;
        isc_region_t r;
 
@@ -2778,10 +2759,7 @@ dns_message_getquerytsig(dns_message_t *msg, isc_mem_t *mctx,
                return ISC_R_SUCCESS;
        }
 
-       result = dns_rdataset_first(msg->tsig);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdataset_first(msg->tsig));
        dns_rdataset_current(msg->tsig, &rdata);
        dns_rdata_toregion(&rdata, &r);
 
@@ -2917,10 +2895,7 @@ dns_message_signer(dns_message_t *msg, dns_name_t *signer) {
                INSIST(result == ISC_R_SUCCESS);
                dns_rdataset_current(msg->sig0, &rdata);
 
-               result = dns_rdata_tostruct(&rdata, &sig, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rdata_tostruct(&rdata, &sig, NULL));
 
                if (msg->verified_sig && msg->sig0status == dns_rcode_noerror) {
                        result = ISC_R_SUCCESS;
@@ -3111,10 +3086,7 @@ dns_message_checksig(dns_message_t *msg, dns_view_t *view) {
                        return ISC_R_UNEXPECTEDEND;
                }
 
-               result = dns_rdata_tostruct(&sigrdata, &sig, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rdata_tostruct(&sigrdata, &sig, NULL));
 
                dns_rdataset_init(&keyset);
                if (view == NULL) {
@@ -4168,11 +4140,8 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section,
                        switch (optcode) {
                        case DNS_OPT_LLQ:
                                if (optlen == 18U) {
-                                       result = render_llq(&optbuf, msg, style,
-                                                           target);
-                                       if (result != ISC_R_SUCCESS) {
-                                               return result;
-                                       }
+                                       RETERR(render_llq(&optbuf, msg, style,
+                                                         target));
                                        ADD_STRING(target, "\n");
                                        continue;
                                }
@@ -4225,11 +4194,8 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section,
                                        snprintf(buf, sizeof(buf), " %u", secs);
                                        ADD_STRING(target, buf);
                                        ADD_STRING(target, " (");
-                                       result = dns_ttl_totext(secs, true,
-                                                               true, target);
-                                       if (result != ISC_R_SUCCESS) {
-                                               return result;
-                                       }
+                                       RETERR(dns_ttl_totext(secs, true, true,
+                                                             target));
                                        ADD_STRING(target, ")\n");
                                        continue;
                                }
@@ -4479,7 +4445,7 @@ isc_result_t
 dns_message_headertotext(dns_message_t *msg, const dns_master_style_t *style,
                         dns_messagetextflag_t flags, isc_buffer_t *target) {
        char buf[sizeof("1234567890")];
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
 
        REQUIRE(DNS_MESSAGE_VALID(msg));
        REQUIRE(target != NULL);
@@ -4495,10 +4461,7 @@ dns_message_headertotext(dns_message_t *msg, const dns_master_style_t *style,
                ADD_STRING(target, "\n");
                INDENT(style);
                ADD_STRING(target, "status: ");
-               result = dns_rcode_totext(msg->rcode, target);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rcode_totext(msg->rcode, target));
                ADD_STRING(target, "\n");
                INDENT(style);
                ADD_STRING(target, "id: ");
@@ -4581,10 +4544,7 @@ dns_message_headertotext(dns_message_t *msg, const dns_master_style_t *style,
                ADD_STRING(target, ";; ->>HEADER<<- opcode: ");
                ADD_STRING(target, opcodetext[msg->opcode]);
                ADD_STRING(target, ", status: ");
-               result = dns_rcode_totext(msg->rcode, target);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rcode_totext(msg->rcode, target));
                ADD_STRING(target, ", id: ");
                snprintf(buf, sizeof(buf), "%6u", msg->id);
                ADD_STRING(target, buf);
@@ -4659,55 +4619,24 @@ cleanup:
 isc_result_t
 dns_message_totext(dns_message_t *msg, const dns_master_style_t *style,
                   dns_messagetextflag_t flags, isc_buffer_t *target) {
-       isc_result_t result;
-
        REQUIRE(DNS_MESSAGE_VALID(msg));
        REQUIRE(target != NULL);
 
-       result = dns_message_headertotext(msg, style, flags, target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = dns_message_pseudosectiontotext(msg, DNS_PSEUDOSECTION_OPT,
-                                                style, flags, target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = dns_message_sectiontotext(msg, DNS_SECTION_QUESTION, style,
-                                          flags, target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = dns_message_sectiontotext(msg, DNS_SECTION_ANSWER, style,
-                                          flags, target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = dns_message_sectiontotext(msg, DNS_SECTION_AUTHORITY, style,
-                                          flags, target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = dns_message_sectiontotext(msg, DNS_SECTION_ADDITIONAL, style,
-                                          flags, target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = dns_message_pseudosectiontotext(msg, DNS_PSEUDOSECTION_TSIG,
-                                                style, flags, target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
-       result = dns_message_pseudosectiontotext(msg, DNS_PSEUDOSECTION_SIG0,
-                                                style, flags, target);
-       return result;
+       RETERR(dns_message_headertotext(msg, style, flags, target));
+       RETERR(dns_message_pseudosectiontotext(msg, DNS_PSEUDOSECTION_OPT,
+                                              style, flags, target));
+       RETERR(dns_message_sectiontotext(msg, DNS_SECTION_QUESTION, style,
+                                        flags, target));
+       RETERR(dns_message_sectiontotext(msg, DNS_SECTION_ANSWER, style, flags,
+                                        target));
+       RETERR(dns_message_sectiontotext(msg, DNS_SECTION_AUTHORITY, style,
+                                        flags, target));
+       RETERR(dns_message_sectiontotext(msg, DNS_SECTION_ADDITIONAL, style,
+                                        flags, target));
+       RETERR(dns_message_pseudosectiontotext(msg, DNS_PSEUDOSECTION_TSIG,
+                                              style, flags, target));
+       return dns_message_pseudosectiontotext(msg, DNS_PSEUDOSECTION_SIG0,
+                                              style, flags, target);
 }
 
 isc_region_t *
index 9613d7e3b4286a63117fc243727e4616772539fe..c9b3709c1e6b0f6b17cccda713fa72568271e030 100644 (file)
@@ -1707,7 +1707,6 @@ dns_name_dynamic(const dns_name_t *name) {
 
 isc_result_t
 dns_name_print(const dns_name_t *name, FILE *stream) {
-       isc_result_t result;
        isc_buffer_t b;
        isc_region_t r;
        char t[1024];
@@ -1719,10 +1718,7 @@ dns_name_print(const dns_name_t *name, FILE *stream) {
        REQUIRE(DNS_NAME_VALID(name));
 
        isc_buffer_init(&b, t, sizeof(t));
-       result = dns_name_totext(name, 0, &b);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_totext(name, 0, &b));
        isc_buffer_usedregion(&b, &r);
        fprintf(stream, "%.*s", (int)r.length, (char *)r.base);
 
@@ -1774,7 +1770,6 @@ dns_name_format(const dns_name_t *name, char *cp, unsigned int size) {
  */
 isc_result_t
 dns_name_tostring(const dns_name_t *name, char **target, isc_mem_t *mctx) {
-       isc_result_t result;
        isc_buffer_t buf;
        isc_region_t reg;
        char *p, txt[DNS_NAME_FORMATSIZE];
@@ -1783,10 +1778,7 @@ dns_name_tostring(const dns_name_t *name, char **target, isc_mem_t *mctx) {
        REQUIRE(target != NULL && *target == NULL);
 
        isc_buffer_init(&buf, txt, sizeof(txt));
-       result = dns_name_totext(name, 0, &buf);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_totext(name, 0, &buf));
 
        isc_buffer_usedregion(&buf, &reg);
        p = isc_mem_allocate(mctx, reg.length + 1);
@@ -1801,7 +1793,6 @@ isc_result_t
 dns_name_fromstring(dns_name_t *target, const char *src,
                    const dns_name_t *origin, unsigned int options,
                    isc_mem_t *mctx) {
-       isc_result_t result;
        isc_buffer_t buf;
        dns_fixedname_t fn;
        dns_name_t *name;
@@ -1816,15 +1807,13 @@ dns_name_fromstring(dns_name_t *target, const char *src,
                name = dns_fixedname_initname(&fn);
        }
 
-       result = dns_name_fromtext(name, &buf, origin, options);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromtext(name, &buf, origin, options));
 
        if (name != target) {
                dns_name_dup(name, mctx, target);
        }
-       return result;
+
+       return ISC_R_SUCCESS;
 }
 
 void
index 3436321105344bfb25f5bde3a479d016955c4c65..54e72928fba17800fb28e7c8db8891f98567ca06 100644 (file)
@@ -68,7 +68,6 @@ copy_rdataset(dns_rdataset_t *rdataset, isc_buffer_t *buffer) {
        isc_buffer_putuint16(buffer, (uint16_t)count);
 
        DNS_RDATASET_FOREACH(rdataset) {
-               isc_result_t result;
                dns_rdata_t rdata = DNS_RDATA_INIT;
                dns_rdataset_current(rdataset, &rdata);
 
@@ -85,10 +84,7 @@ copy_rdataset(dns_rdataset_t *rdataset, isc_buffer_t *buffer) {
                /*
                 * Copy the rdata to the buffer.
                 */
-               result = isc_buffer_copyregion(buffer, &r);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(isc_buffer_copyregion(buffer, &r));
        }
 
        return ISC_R_SUCCESS;
@@ -142,8 +138,6 @@ dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
        isc_buffer_init(&buffer, data, sizeof(data));
 
        MSG_SECTION_FOREACH(message, DNS_SECTION_AUTHORITY, name) {
-               result = ISC_R_SUCCESS;
-
                if (name->attributes.ncache) {
                        ISC_LIST_FOREACH(name->list, rdataset, link) {
                                if (!rdataset->attributes.ncache) {
@@ -169,11 +163,8 @@ dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
                                         * Copy the owner name to the buffer.
                                         */
                                        dns_name_toregion(name, &r);
-                                       result = isc_buffer_copyregion(&buffer,
-                                                                      &r);
-                                       if (result != ISC_R_SUCCESS) {
-                                               return result;
-                                       }
+                                       RETERR(isc_buffer_copyregion(&buffer,
+                                                                    &r));
                                        /*
                                         * Copy the type to the buffer.
                                         */
@@ -189,11 +180,8 @@ dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
                                        /*
                                         * Copy the rdataset into the buffer.
                                         */
-                                       result = copy_rdataset(rdataset,
-                                                              &buffer);
-                                       if (result != ISC_R_SUCCESS) {
-                                               return result;
-                                       }
+                                       RETERR(copy_rdataset(rdataset,
+                                                            &buffer));
 
                                        if (next >= DNS_NCACHE_RDATA) {
                                                return ISC_R_NOSPACE;
index 1ebc6e8995a1798aa467b96187ff6ab50aac9627..145ada6b171c1d0e7b81ffb1d5b73442387521b8 100644 (file)
@@ -95,7 +95,6 @@ isc_result_t
 dns_nsec_buildrdata(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
                    const dns_name_t *target, unsigned char *buffer,
                    dns_rdata_t *rdata) {
-       isc_result_t result;
        isc_region_t r;
        unsigned int i;
        unsigned char *nsec_bits, *bm;
@@ -118,10 +117,7 @@ dns_nsec_buildrdata(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
        dns_nsec_setbit(bm, dns_rdatatype_nsec, 1);
        max_type = dns_rdatatype_nsec;
        rdsiter = NULL;
-       result = dns_db_allrdatasets(db, node, version, 0, 0, &rdsiter);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_allrdatasets(db, node, version, 0, 0, &rdsiter));
        DNS_RDATASETITER_FOREACH(rdsiter) {
                dns_rdataset_t rdataset = DNS_RDATASET_INIT;
                dns_rdatasetiter_current(rdsiter, &rdataset);
@@ -243,10 +239,7 @@ dns_nsec_nseconly(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
 
        dns_rdataset_init(&rdataset);
 
-       result = dns_db_getoriginnode(db, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getoriginnode(db, &node));
 
        result = dns_db_findrdataset(db, node, version, dns_rdatatype_dnskey, 0,
                                     0, &rdataset, NULL);
@@ -419,10 +412,7 @@ dns_nsec_noexistnodata(dns_rdatatype_t type, const dns_name_t *name,
                return DNS_R_DNAME;
        }
 
-       result = dns_rdata_tostruct(&rdata, &nsec, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdata_tostruct(&rdata, &nsec, NULL));
        relation = dns_name_fullcompare(&nsec.next, name, &order, &nlabels);
        if (order == 0) {
                dns_rdata_freestruct(&nsec);
index 164b5f69005e6c437f4da63ec9877172b358478e..ff53e90be91cd1e8bf99b368b8874b0bc9e50889 100644 (file)
@@ -53,7 +53,6 @@ dns_nsec3_buildrdata(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
                     size_t salt_length, const unsigned char *nexthash,
                     size_t hash_length, unsigned char *buffer,
                     dns_rdata_t *rdata) {
-       isc_result_t result;
        isc_region_t r;
        unsigned int i;
        bool found;
@@ -108,10 +107,7 @@ dns_nsec3_buildrdata(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
                goto collapse_bitmap;
        }
        rdsiter = NULL;
-       result = dns_db_allrdatasets(db, node, version, 0, 0, &rdsiter);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_allrdatasets(db, node, version, 0, 0, &rdsiter));
        found = found_ns = need_rrsig = false;
        DNS_RDATASETITER_FOREACH(rdsiter) {
                dns_rdataset_t rdataset = DNS_RDATASET_INIT;
@@ -883,10 +879,7 @@ dns_nsec3_addnsec3s(dns_db_t *db, dns_dbversion_t *version,
        /*
         * Find the NSEC3 parameters for this zone.
         */
-       result = dns_db_getoriginnode(db, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getoriginnode(db, &node));
 
        result = dns_db_findrdataset(db, node, version,
                                     dns_rdatatype_nsec3param, 0, 0, &rdataset,
@@ -1016,7 +1009,6 @@ cleanup:
 isc_result_t
 dns_nsec3param_salttotext(dns_rdata_nsec3param_t *nsec3param, char *dst,
                          size_t dstlen) {
-       isc_result_t result;
        isc_region_t r;
        isc_buffer_t b;
 
@@ -1035,10 +1027,7 @@ dns_nsec3param_salttotext(dns_rdata_nsec3param_t *nsec3param, char *dst,
        r.length = nsec3param->salt_length;
        isc_buffer_init(&b, dst, (unsigned int)dstlen);
 
-       result = isc_hex_totext(&r, 2, "", &b);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_hex_totext(&r, 2, "", &b));
 
        if (isc_buffer_availablelength(&b) < 1) {
                return ISC_R_NOSPACE;
@@ -1064,10 +1053,7 @@ dns_nsec3param_deletechains(dns_db_t *db, dns_dbversion_t *ver,
        dns_name_init(&next);
        dns_rdataset_init(&rdataset);
 
-       result = dns_db_getoriginnode(db, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getoriginnode(db, &node));
 
        /*
         * Cause all NSEC3 chains to be deleted.
@@ -1180,10 +1166,7 @@ dns_nsec3_addnsec3sx(dns_db_t *db, dns_dbversion_t *version,
        /*
         * Find the NSEC3 parameters for this zone.
         */
-       result = dns_db_getoriginnode(db, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getoriginnode(db, &node));
 
        result = dns_db_findrdataset(db, node, version, type, 0, 0, &prdataset,
                                     NULL);
@@ -1588,10 +1571,7 @@ dns_nsec3_delnsec3sx(dns_db_t *db, dns_dbversion_t *version,
        /*
         * Find the NSEC3 parameters for this zone.
         */
-       result = dns_db_getoriginnode(db, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getoriginnode(db, &node));
 
        result = dns_db_findrdataset(db, node, version,
                                     dns_rdatatype_nsec3param, 0, 0, &rdataset,
@@ -1693,10 +1673,7 @@ dns_nsec3_activex(dns_db_t *db, dns_dbversion_t *version, bool complete,
 
        dns_rdataset_init(&rdataset);
 
-       result = dns_db_getoriginnode(db, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getoriginnode(db, &node));
 
        result = dns_db_findrdataset(db, node, version,
                                     dns_rdatatype_nsec3param, 0, 0, &rdataset,
@@ -1819,10 +1796,7 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name,
 
        dns_rdataset_current(nsec3set, &rdata);
 
-       result = dns_rdata_tostruct(&rdata, &nsec3, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdata_tostruct(&rdata, &nsec3, NULL));
 
        (*logit)(arg, ISC_LOG_DEBUG(3), "looking for relevant NSEC3");
 
@@ -1884,10 +1858,7 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name,
        dns_name_getlabel(nsec3name, 0, &hashlabel);
        isc_region_consume(&hashlabel, 1);
        isc_buffer_init(&buffer, owner, sizeof(owner));
-       result = isc_base32hex_decoderegion(&hashlabel, &buffer);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_base32hex_decoderegion(&hashlabel, &buffer));
 
        /*
         * The hash lengths should match.  If not ignore the record.
index a026c752f1c832285944033e5ee6c525fad63a28..e2a20faf8b2c3c2cf59149cd326c85d23bedd39e 100644 (file)
@@ -453,12 +453,7 @@ done:
 
 static isc_result_t
 putstr(isc_buffer_t *b, const char *str) {
-       isc_result_t result;
-
-       result = isc_buffer_reserve(b, strlen(str));
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_buffer_reserve(b, strlen(str)));
 
        isc_buffer_putstr(b, str);
        return ISC_R_SUCCESS;
index b2f2f2ea7ccf8c89cc70967efc61ce961dce06c1..6fd0cca842014248357a74477182469e884afa82 100644 (file)
@@ -916,22 +916,18 @@ cleanup:
 
 static isc_result_t
 opensslecdsa_generate(dst_key_t *key, int unused, void (*callback)(int)) {
-       isc_result_t ret;
        EVP_PKEY *pkey = NULL;
 
        REQUIRE(opensslecdsa_valid_key_alg(key->key_alg));
        UNUSED(unused);
        UNUSED(callback);
 
-       ret = opensslecdsa_generate_pkey(key->key_alg, key->label, &pkey);
-       if (ret != ISC_R_SUCCESS) {
-               return ret;
-       }
+       RETERR(opensslecdsa_generate_pkey(key->key_alg, key->label, &pkey));
 
        key->key_size = EVP_PKEY_bits(pkey);
        key->keydata.pkeypair.priv = pkey;
        key->keydata.pkeypair.pub = pkey;
-       return ret;
+       return ISC_R_SUCCESS;
 }
 
 static isc_result_t
index ea164be6f96f0e3d662571ec90eed2c7bf318a58..b51e40a058189bd9522e64a4ea1f10b3a16b1e74 100644 (file)
@@ -330,7 +330,6 @@ openssleddsa_todns(const dst_key_t *key, isc_buffer_t *data) {
 static isc_result_t
 openssleddsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
        const eddsa_alginfo_t *alginfo = openssleddsa_alg_info(key->key_alg);
-       isc_result_t ret;
        isc_region_t r;
        size_t len;
        EVP_PKEY *pkey = NULL;
@@ -343,10 +342,7 @@ openssleddsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
        }
 
        len = r.length;
-       ret = raw_key_to_ossl(alginfo, 0, r.base, &len, &pkey);
-       if (ret != ISC_R_SUCCESS) {
-               return ret;
-       }
+       RETERR(raw_key_to_ossl(alginfo, 0, r.base, &len, &pkey));
 
        isc_buffer_forward(data, len);
        key->keydata.pkeypair.pub = pkey;
index 194f55b004042f0e32f61432938a2ed42b52423d..c5771703ec5d49f5cbcfd3167ddd0d990dd43aef 100644 (file)
@@ -485,11 +485,8 @@ dns_peer_setkeybycharp(dns_peer_t *peer, const char *keyval) {
        dns_fixedname_init(&fname);
        isc_buffer_constinit(&b, keyval, strlen(keyval));
        isc_buffer_add(&b, strlen(keyval));
-       result = dns_name_fromtext(dns_fixedname_name(&fname), &b, dns_rootname,
-                                  0);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromtext(dns_fixedname_name(&fname), &b, dns_rootname,
+                                0));
 
        name = isc_mem_get(peer->mem, sizeof(dns_name_t));
 
index 5ef3d1be630b08e73da625f65fc54d8f89c6ffeb..725d51fe9c5ca51bfe0cbabc986ed4865f2b7451 100644 (file)
@@ -1508,11 +1508,8 @@ find_coveringnsec(qpc_search_t *search, const dns_name_t *name,
         * Lookup the predecessor in the normal namespace.
         */
        node = NULL;
-       result = dns_qp_getname(search->qpdb->tree, predecessor,
-                               DNS_DBNAMESPACE_NORMAL, (void **)&node, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_qp_getname(search->qpdb->tree, predecessor,
+                             DNS_DBNAMESPACE_NORMAL, (void **)&node, NULL));
        dns_name_copy(&node->name, fname);
 
        nlock = &search->qpdb->buckets[node->locknum].lock;
index ed7d0ad14678cf7e03ada98393c363562f891bfe..5ad80cebc95c680d257181f84a4d4cf2e0ab6c05 100644 (file)
@@ -1252,33 +1252,23 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
 static isc_result_t
 unknown_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
               isc_buffer_t *target) {
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        char buf[sizeof("65535")];
        isc_region_t sr;
 
        strlcpy(buf, "\\# ", sizeof(buf));
-       result = str_totext(buf, target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(str_totext(buf, target));
 
        dns_rdata_toregion(rdata, &sr);
        INSIST(sr.length < 65536);
        snprintf(buf, sizeof(buf), "%u", sr.length);
-       result = str_totext(buf, target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(str_totext(buf, target));
 
        if (sr.length != 0U) {
                if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) {
-                       result = str_totext(" ( ", target);
+                       RETERR(str_totext(" ( ", target));
                } else {
-                       result = str_totext(" ", target);
-               }
-
-               if (result != ISC_R_SUCCESS) {
-                       return result;
+                       RETERR(str_totext(" ", target));
                }
 
                if (tctx->width == 0) { /* No splitting */
index 1351ab420f2b5a988aee1cb39a25bd7ee55bcae4..f2fe025af8262727837fbaa4c6067cc0d53a2929 100644 (file)
@@ -187,7 +187,6 @@ static isc_result_t
 additionaldata_lp(ARGS_ADDLDATA) {
        dns_name_t name;
        isc_region_t region;
-       isc_result_t result;
 
        REQUIRE(rdata->type == dns_rdatatype_lp);
 
@@ -198,10 +197,7 @@ additionaldata_lp(ARGS_ADDLDATA) {
        isc_region_consume(&region, 2);
        dns_name_fromregion(&name, &region);
 
-       result = (add)(arg, &name, dns_rdatatype_l32, NULL DNS__DB_FILELINE);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR((add)(arg, &name, dns_rdatatype_l32, NULL DNS__DB_FILELINE));
        return (add)(arg, &name, dns_rdatatype_l64, NULL DNS__DB_FILELINE);
 }
 
index 2eb8036d9fead43920de4f9ba9ab289f27cb8869..96b738251ef7023a97bc64358a7d49287f1a16d9 100644 (file)
@@ -255,17 +255,13 @@ static isc_result_t
 digest_minfo(ARGS_DIGEST) {
        isc_region_t r;
        dns_name_t name;
-       isc_result_t result;
 
        REQUIRE(rdata->type == dns_rdatatype_minfo);
 
        dns_rdata_toregion(rdata, &r);
        dns_name_init(&name);
        dns_name_fromregion(&name, &r);
-       result = dns_name_digest(&name, digest, arg);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_digest(&name, digest, arg));
        isc_region_consume(&r, name_length(&name));
        dns_name_init(&name);
        dns_name_fromregion(&name, &r);
index 25cbfe922470e3999cb38bdf16e37896dbdf576e..474fae44096a611e4a295ee9de313533b70bba61 100644 (file)
@@ -282,10 +282,7 @@ additionaldata_mx(ARGS_ADDLDATA) {
                return ISC_R_SUCCESS;
        }
 
-       result = (add)(arg, &name, dns_rdatatype_a, NULL DNS__DB_FILELINE);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR((add)(arg, &name, dns_rdatatype_a, NULL DNS__DB_FILELINE));
 
        dns_fixedname_init(&fixed);
        result = dns_name_concatenate(&port25, &name,
index fcc11a5b8499304b7379c8f050ef604a9df186df..158dea6f887e7af14e6b70cf8c940485ee67e41b 100644 (file)
@@ -626,7 +626,6 @@ static isc_result_t
 digest_naptr(ARGS_DIGEST) {
        isc_region_t r1, r2;
        unsigned int length, n;
-       isc_result_t result;
        dns_name_t name;
 
        REQUIRE(rdata->type == dns_rdatatype_naptr);
@@ -666,10 +665,7 @@ digest_naptr(ARGS_DIGEST) {
         * Digest the RR up to the replacement name.
         */
        r1.length = length;
-       result = (digest)(arg, &r1);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR((digest)(arg, &r1));
 
        /*
         * Replacement.
index 95bd1e8de8a01a15e38c5e9314d86ee2fc1f2ca7..1eec28ffd8851dab4502b3369a2b6b28b29cc81f 100644 (file)
@@ -290,17 +290,13 @@ static isc_result_t
 digest_nxt(ARGS_DIGEST) {
        isc_region_t r;
        dns_name_t name;
-       isc_result_t result;
 
        REQUIRE(rdata->type == dns_rdatatype_nxt);
 
        dns_rdata_toregion(rdata, &r);
        dns_name_init(&name);
        dns_name_fromregion(&name, &r);
-       result = dns_name_digest(&name, digest, arg);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_digest(&name, digest, arg));
        isc_region_consume(&r, name_length(&name));
 
        return (digest)(arg, &r);
index 1138fb75250c647749fa0e4db86bc4fa0d634fe6..8323f9233c93f2ae1ba64412b90d3edb2094818c 100644 (file)
@@ -239,7 +239,6 @@ static isc_result_t
 additionaldata_rt(ARGS_ADDLDATA) {
        dns_name_t name;
        isc_region_t region;
-       isc_result_t result;
 
        REQUIRE(rdata->type == dns_rdatatype_rt);
 
@@ -250,21 +249,14 @@ additionaldata_rt(ARGS_ADDLDATA) {
        isc_region_consume(&region, 2);
        dns_name_fromregion(&name, &region);
 
-       result = (add)(arg, &name, dns_rdatatype_x25, NULL DNS__DB_FILELINE);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-       result = (add)(arg, &name, dns_rdatatype_isdn, NULL DNS__DB_FILELINE);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR((add)(arg, &name, dns_rdatatype_x25, NULL DNS__DB_FILELINE));
+       RETERR((add)(arg, &name, dns_rdatatype_isdn, NULL DNS__DB_FILELINE));
        return (add)(arg, &name, dns_rdatatype_a, NULL DNS__DB_FILELINE);
 }
 
 static isc_result_t
 digest_rt(ARGS_DIGEST) {
        isc_region_t r1, r2;
-       isc_result_t result;
        dns_name_t name;
 
        REQUIRE(rdata->type == dns_rdatatype_rt);
@@ -273,10 +265,7 @@ digest_rt(ARGS_DIGEST) {
        r2 = r1;
        isc_region_consume(&r2, 2);
        r1.length = 2;
-       result = (digest)(arg, &r1);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR((digest)(arg, &r1));
        dns_name_init(&name);
        dns_name_fromregion(&name, &r2);
        return dns_name_digest(&name, digest, arg);
index b61ee8889cdb123188285af1ee2e38725e4f19ee..d4e9878aba675e5708bca3b2dba481987466f6f0 100644 (file)
@@ -71,17 +71,12 @@ generic_totext_txt(ARGS_TOTEXT) {
 
 static isc_result_t
 generic_fromwire_txt(ARGS_FROMWIRE) {
-       isc_result_t result;
-
        UNUSED(type);
        UNUSED(dctx);
        UNUSED(rdclass);
 
        do {
-               result = txt_fromwire(source, target);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(txt_fromwire(source, target));
        } while (!buffer_empty(source));
        return ISC_R_SUCCESS;
 }
index e6c14ed74b0e17ce77968aee3d857ffa448d322b..99f9e3cb9aeb6c6f957d773ae658833d1ba37740 100644 (file)
@@ -415,7 +415,6 @@ static isc_result_t
 digest_in_a6(ARGS_DIGEST) {
        isc_region_t r1, r2;
        unsigned char prefixlen, octets;
-       isc_result_t result;
        dns_name_t name;
 
        REQUIRE(rdata->type == dns_rdatatype_a6);
@@ -427,10 +426,7 @@ digest_in_a6(ARGS_DIGEST) {
        octets = 1 + 16 - prefixlen / 8;
 
        r1.length = octets;
-       result = (digest)(arg, &r1);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR((digest)(arg, &r1));
        if (prefixlen == 0) {
                return ISC_R_SUCCESS;
        }
index 46e82202d4d4e69d849654178df6d2949717cae5..cfc24d5d3ca880f409376896a019e6178cad2b47 100644 (file)
@@ -309,7 +309,6 @@ static isc_result_t
 digest_in_px(ARGS_DIGEST) {
        isc_region_t r1, r2;
        dns_name_t name;
-       isc_result_t result;
 
        REQUIRE(rdata->type == dns_rdatatype_px);
        REQUIRE(rdata->rdclass == dns_rdataclass_in);
@@ -318,16 +317,10 @@ digest_in_px(ARGS_DIGEST) {
        r2 = r1;
        isc_region_consume(&r2, 2);
        r1.length = 2;
-       result = (digest)(arg, &r1);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR((digest)(arg, &r1));
        dns_name_init(&name);
        dns_name_fromregion(&name, &r2);
-       result = dns_name_digest(&name, digest, arg);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_digest(&name, digest, arg));
        isc_region_consume(&r2, name_length(&name));
        dns_name_init(&name);
        dns_name_fromregion(&name, &r2);
index c0b2cf86e3f2c65a38ed424eac010f777bee4850..755a87518000578a4a69a8e9707aa766ad458d2d 100644 (file)
@@ -328,10 +328,7 @@ additionaldata_in_srv(ARGS_ADDLDATA) {
                return ISC_R_SUCCESS;
        }
 
-       result = (add)(arg, &name, dns_rdatatype_a, NULL DNS__DB_FILELINE);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR((add)(arg, &name, dns_rdatatype_a, NULL DNS__DB_FILELINE));
 
        dns_fixedname_init(&fixed);
        snprintf(buf, sizeof(buf), "_%u._tcp", port);
index 593b09771e550e6718ee82579a16fc3ca5ebed88..c418bed890b52a64c51773b8dc8973d8f37b594b 100644 (file)
@@ -447,13 +447,9 @@ dns_rdataset_additionaldata(dns_rdataset_t *rdataset,
        }
 
        DNS_RDATASET_FOREACH(rdataset) {
-               isc_result_t result;
                dns_rdata_t rdata = DNS_RDATA_INIT;
                dns_rdataset_current(rdataset, &rdata);
-               result = dns_rdata_additionaldata(&rdata, owner_name, add, arg);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rdata_additionaldata(&rdata, owner_name, add, arg));
        }
 
        return ISC_R_SUCCESS;
index 00556da402d05901740e4e2efd2d3936af41a980..46148c2bb0e505ab406db356ec361056ee177595 100644 (file)
@@ -748,8 +748,6 @@ dns_request_cancel(dns_request_t *request) {
 isc_result_t
 dns_request_getresponse(dns_request_t *request, dns_message_t *message,
                        unsigned int options) {
-       isc_result_t result;
-
        REQUIRE(VALID_REQUEST(request));
        REQUIRE(request->tid == isc_tid());
        REQUIRE(request->answer != NULL);
@@ -757,18 +755,12 @@ dns_request_getresponse(dns_request_t *request, dns_message_t *message,
        req_log(ISC_LOG_DEBUG(3), "%s: request %p", __func__, request);
 
        dns_message_setquerytsig(message, request->tsig);
-       result = dns_message_settsigkey(message, request->tsigkey);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-       result = dns_message_parse(message, request->answer, options);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_message_settsigkey(message, request->tsigkey));
+       RETERR(dns_message_parse(message, request->answer, options));
        if (request->tsigkey != NULL) {
-               result = dns_tsig_verify(request->answer, message, NULL, NULL);
+               RETERR(dns_tsig_verify(request->answer, message, NULL, NULL));
        }
-       return result;
+       return ISC_R_SUCCESS;
 }
 
 isc_buffer_t *
index 9a31ddeb28603215f608e1864f7c92772a016ddc..e53666c70cbfa125fe304a3ccdc741215bc45945 100644 (file)
@@ -281,7 +281,6 @@ static isc_result_t
 resconf_parsenameserver(irs_resconf_t *conf, FILE *fp) {
        char word[RESCONFMAXLINELEN];
        int cp;
-       isc_result_t result;
 
        cp = getword(fp, word, sizeof(word));
        if (cp == EOF || strlen(word) == 0U) {
@@ -298,10 +297,7 @@ resconf_parsenameserver(irs_resconf_t *conf, FILE *fp) {
                return ISC_R_SUCCESS;
        }
 
-       result = add_server(conf->mctx, word, &conf->nameservers);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(add_server(conf->mctx, word, &conf->nameservers));
        conf->numns++;
 
        return ISC_R_SUCCESS;
@@ -370,7 +366,6 @@ static isc_result_t
 resconf_parsesearch(irs_resconf_t *conf, FILE *fp) {
        int delim;
        char word[RESCONFMAXLINELEN];
-       isc_result_t result;
 
        if (conf->domainname != NULL) {
                /*
@@ -389,10 +384,7 @@ resconf_parsesearch(irs_resconf_t *conf, FILE *fp) {
                return ISC_R_UNEXPECTEDEND; /* Nothing else on line. */
        }
        do {
-               result = add_search(conf, word);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(add_search(conf, word));
 
                if (delim == '\n') {
                        break;
index 2d171650549832c3ee5916fbad5c1437626b72ae..018d76e739b83c82bae82eb1074cd6eaa6352d77 100644 (file)
@@ -6174,7 +6174,7 @@ rctx_cache_insecure(respctx_t *rctx, dns_message_t *message, dns_name_t *name,
 
 static isc_result_t
 rctx_cachename(respctx_t *rctx, dns_message_t *message, dns_name_t *name) {
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        fetchctx_t *fctx = rctx->fctx;
        resquery_t *query = rctx->query;
        dns_resolver_t *res = fctx->res;
@@ -6198,10 +6198,7 @@ rctx_cachename(respctx_t *rctx, dns_message_t *message, dns_name_t *name) {
        /*
         * Find or create the cache node.
         */
-       result = dns_db_findnode(fctx->cache, name, true, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_findnode(fctx->cache, name, true, &node));
 
        /*
         * Cache or validate each cacheable rdataset.
@@ -6239,9 +6236,7 @@ rctx_cachename(respctx_t *rctx, dns_message_t *message, dns_name_t *name) {
                        result = rctx_cache_insecure(rctx, message, name, node,
                                                     rdataset, sigrdataset);
                }
-               if (result != ISC_R_SUCCESS) {
-                       goto cleanup;
-               }
+               CHECK(result);
        }
 
        /*
index f672ea5d54e621311370ca1487e9a42defdcab1e..f5eadd98396acd5279b97948105b7b6c60c621f6 100644 (file)
@@ -101,7 +101,6 @@ static struct upcoming {
 
 static isc_result_t
 in_rootns(dns_rdataset_t *rootns, dns_name_t *name) {
-       isc_result_t result;
        dns_rdata_ns_t ns;
 
        if (!dns_rdataset_isassociated(rootns)) {
@@ -111,10 +110,7 @@ in_rootns(dns_rdataset_t *rootns, dns_name_t *name) {
        DNS_RDATASET_FOREACH(rootns) {
                dns_rdata_t rdata = DNS_RDATA_INIT;
                dns_rdataset_current(rootns, &rdata);
-               result = dns_rdata_tostruct(&rdata, &ns, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rdata_tostruct(&rdata, &ns, NULL));
                if (dns_name_compare(name, &ns.name) == 0) {
                        return ISC_R_SUCCESS;
                }
index 6004190b94368b9930c2c4cedf3a4e2d88a51bf3..e0e9bbd6d46d3ba0ea354a1138ffe2095acdc2e1 100644 (file)
@@ -1480,7 +1480,6 @@ dns_rpz_new_zones(dns_view_t *view, dns_rpz_zones_t **rpzsp, bool first_time) {
 
 isc_result_t
 dns_rpz_new_zone(dns_rpz_zones_t *rpzs, dns_rpz_zone_t **rpzp) {
-       isc_result_t result;
        dns_rpz_zone_t *rpz = NULL;
 
        REQUIRE(DNS_RPZ_ZONES_VALID(rpzs));
@@ -1490,10 +1489,7 @@ dns_rpz_new_zone(dns_rpz_zones_t *rpzs, dns_rpz_zone_t **rpzp) {
                return ISC_R_NOSPACE;
        }
 
-       result = dns__rpz_shuttingdown(rpzs);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns__rpz_shuttingdown(rpzs));
 
        rpz = isc_mem_get(rpzs->mctx, sizeof(*rpz));
        *rpz = (dns_rpz_zone_t){
index 2adf531cb3e06fa78b7fa50745277c011b4d756e..3e468cbe5facde402052158cae4560fe99939bb2 100644 (file)
 isc_result_t
 dns_rriterator_init(dns_rriterator_t *it, dns_db_t *db, dns_dbversion_t *ver,
                    isc_stdtime_t now) {
-       isc_result_t result;
        it->magic = RRITERATOR_MAGIC;
        it->db = db;
        it->dbit = NULL;
        it->ver = ver;
        it->now = now;
        it->node = NULL;
-       result = dns_db_createiterator(it->db, 0, &it->dbit);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_createiterator(it->db, 0, &it->dbit));
        it->rdatasetit = NULL;
        dns_rdata_init(&it->rdata);
        dns_rdataset_init(&it->rdataset);
index 1393bc909acf86e7e5d60f1de070eedd03c7b042..96adec1e396938b5265ebc200bf378b634a930d0 100644 (file)
@@ -492,30 +492,18 @@ getnodedata(dns_db_t *db, const dns_name_t *name, bool create,
                         dns_name_countlabels(&sdlz->common.origin);
                dns_name_init(&relname);
                dns_name_getlabelsequence(name, 0, labels, &relname);
-               result = dns_name_totext(&relname, DNS_NAME_OMITFINALDOT, &b);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_name_totext(&relname, DNS_NAME_OMITFINALDOT, &b));
        } else {
-               result = dns_name_totext(name, DNS_NAME_OMITFINALDOT, &b);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_name_totext(name, DNS_NAME_OMITFINALDOT, &b));
        }
        isc_buffer_putuint8(&b, 0);
 
        isc_buffer_init(&b2, zonestr, sizeof(zonestr));
-       result = dns_name_totext(&sdlz->common.origin, DNS_NAME_OMITFINALDOT,
-                                &b2);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_totext(&sdlz->common.origin, DNS_NAME_OMITFINALDOT,
+                              &b2));
        isc_buffer_putuint8(&b2, 0);
 
-       result = createnode(sdlz, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(createnode(sdlz, &node));
 
        isorigin = dns_name_equal(name, &sdlz->common.origin);
 
@@ -687,11 +675,8 @@ createiterator(dns_db_t *db, unsigned int options,
        }
 
        isc_buffer_init(&b, zonestr, sizeof(zonestr));
-       result = dns_name_totext(&sdlz->common.origin, DNS_NAME_OMITFINALDOT,
-                                &b);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_totext(&sdlz->common.origin, DNS_NAME_OMITFINALDOT,
+                              &b));
        isc_buffer_putuint8(&b, 0);
 
        sdlziter = isc_mem_get(sdlz->common.mctx, sizeof(sdlz_dbiterator_t));
@@ -1336,19 +1321,13 @@ dns_sdlzallowzonexfr(void *driverarg, void *dbdata, isc_mem_t *mctx,
 
        /* Convert DNS name to ascii text */
        isc_buffer_init(&b, namestr, sizeof(namestr));
-       result = dns_name_totext(name, DNS_NAME_OMITFINALDOT, &b);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_totext(name, DNS_NAME_OMITFINALDOT, &b));
        isc_buffer_putuint8(&b, 0);
 
        /* convert client address to ascii text */
        isc_buffer_init(&b2, clientstr, sizeof(clientstr));
        isc_netaddr_fromsockaddr(&netaddr, clientaddr);
-       result = isc_netaddr_totext(&netaddr, &b2);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_netaddr_totext(&netaddr, &b2));
        isc_buffer_putuint8(&b2, 0);
 
        /* make sure strings are always lowercase */
@@ -1455,10 +1434,7 @@ dns_sdlzfindzone(void *driverarg, void *dbdata, isc_mem_t *mctx,
 
        /* Convert DNS name to ascii text */
        isc_buffer_init(&b, namestr, sizeof(namestr));
-       result = dns_name_totext(name, DNS_NAME_OMITFINALDOT, &b);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_totext(name, DNS_NAME_OMITFINALDOT, &b));
        isc_buffer_putuint8(&b, 0);
 
        /* make sure strings are always lowercase */
@@ -1599,10 +1575,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
 
        r.base = type;
        r.length = strlen(type);
-       result = dns_rdatatype_fromtext(&typeval, (void *)&r);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdatatype_fromtext(&typeval, (void *)&r));
 
        rdatalist = ISC_LIST_HEAD(lookup->lists);
        while (rdatalist != NULL) {
@@ -1702,7 +1675,6 @@ dns_sdlz_putnamedrr(dns_sdlzallnodes_t *allnodes, const char *name,
        dns_sdlznode_t *sdlznode;
        isc_mem_t *mctx = sdlz->common.mctx;
        isc_buffer_t b;
-       isc_result_t result;
 
        newname = dns_fixedname_initname(&fnewname);
 
@@ -1714,10 +1686,7 @@ dns_sdlz_putnamedrr(dns_sdlzallnodes_t *allnodes, const char *name,
        isc_buffer_constinit(&b, name, strlen(name));
        isc_buffer_add(&b, strlen(name));
 
-       result = dns_name_fromtext(newname, &b, origin, 0);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromtext(newname, &b, origin, 0));
 
        if (allnodes->common.relative_names) {
                /* All names are relative to the root */
@@ -1728,10 +1697,7 @@ dns_sdlz_putnamedrr(dns_sdlzallnodes_t *allnodes, const char *name,
        sdlznode = ISC_LIST_HEAD(allnodes->nodelist);
        if (sdlznode == NULL || !dns_name_equal(&sdlznode->name, newname)) {
                sdlznode = NULL;
-               result = createnode(sdlz, &sdlznode);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(createnode(sdlz, &sdlznode));
                dns_name_dup(newname, mctx, &sdlznode->name);
                ISC_LIST_PREPEND(allnodes->nodelist, sdlznode, link);
                if (allnodes->origin == NULL &&
index 34a259963d0406e9007818023a20f63776d78832..fd57d4bcf3e61ba491d864bdfdf2f7e80c03d38a 100644 (file)
@@ -142,8 +142,6 @@ skrbundle_addtuple(dns_skrbundle_t *bundle, dns_difftuple_t **tuple) {
 isc_result_t
 dns_skrbundle_getsig(dns_skrbundle_t *bundle, dst_key_t *key,
                     dns_rdatatype_t covering_type, dns_rdata_t *sigrdata) {
-       isc_result_t result = ISC_R_SUCCESS;
-
        REQUIRE(DNS_SKRBUNDLE_VALID(bundle));
        REQUIRE(DNS_DIFF_VALID(&bundle->diff));
 
@@ -155,10 +153,7 @@ dns_skrbundle_getsig(dns_skrbundle_t *bundle, dst_key_t *key,
                }
                INSIST(tuple->rdata.type == dns_rdatatype_rrsig);
 
-               result = dns_rdata_tostruct(&tuple->rdata, &rrsig, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rdata_tostruct(&tuple->rdata, &rrsig, NULL));
 
                /*
                 * Check if covering type matches, and if the signature is
index ae23ce0a991ff680630c6b3ecfde056f0c1f16ea..ec49f522e0a84b9bbce1736e5fa0e26a62d30db3 100644 (file)
@@ -204,11 +204,8 @@ dns_time64_fromtext(const char *source, int64_t *target) {
 isc_result_t
 dns_time32_fromtext(const char *source, uint32_t *target) {
        int64_t value64;
-       isc_result_t result;
-       result = dns_time64_fromtext(source, &value64);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+
+       RETERR(dns_time64_fromtext(source, &value64));
        *target = (uint32_t)value64;
 
        return ISC_R_SUCCESS;
index 4618f5ff5855a2a349caef6227488034d0835713..c3b1154fdad31888e4b3d6b27cfe78a2e814364f 100644 (file)
@@ -574,10 +574,7 @@ find_tkey(dns_message_t *msg, dns_name_t **name, dns_rdata_t *rdata,
                result = dns_message_findtype(cur, dns_rdatatype_tkey, 0,
                                              &tkeyset);
                if (result == ISC_R_SUCCESS) {
-                       result = dns_rdataset_first(tkeyset);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(dns_rdataset_first(tkeyset));
 
                        dns_rdataset_current(tkeyset, rdata);
                        *name = cur;
index 88b9d18213b4c67b311616cbc2e97b5257f138aa..03bcc37a4c12ed31e395c9e1711f61962b09a123 100644 (file)
@@ -350,38 +350,26 @@ restore_key(dns_tsigkeyring_t *ring, isc_stdtime_t now, FILE *fp) {
        name = dns_fixedname_initname(&fname);
        isc_buffer_init(&b, namestr, strlen(namestr));
        isc_buffer_add(&b, strlen(namestr));
-       result = dns_name_fromtext(name, &b, dns_rootname, 0);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromtext(name, &b, dns_rootname, 0));
 
        creator = dns_fixedname_initname(&fcreator);
        isc_buffer_init(&b, creatorstr, strlen(creatorstr));
        isc_buffer_add(&b, strlen(creatorstr));
-       result = dns_name_fromtext(creator, &b, dns_rootname, 0);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromtext(creator, &b, dns_rootname, 0));
 
        algorithm = dns_fixedname_initname(&falgorithm);
        isc_buffer_init(&b, algorithmstr, strlen(algorithmstr));
        isc_buffer_add(&b, strlen(algorithmstr));
-       result = dns_name_fromtext(algorithm, &b, dns_rootname, 0);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromtext(algorithm, &b, dns_rootname, 0));
 
        dstalg = dns__tsig_algfromname(algorithm);
        if (dstalg == DST_ALG_UNKNOWN) {
                return DNS_R_BADALG;
        }
 
-       result = dst_key_restore(name, dstalg, DNS_KEYOWNER_ENTITY,
-                                DNS_KEYPROTO_DNSSEC, dns_rdataclass_in,
-                                ring->mctx, keystr, &dstkey);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_restore(name, dstalg, DNS_KEYOWNER_ENTITY,
+                              DNS_KEYPROTO_DNSSEC, dns_rdataclass_in,
+                              ring->mctx, keystr, &dstkey));
 
        result = dns_tsigkey_createfromkey(name, dstalg, dstkey, true, true,
                                           creator, inception, expire,
@@ -483,13 +471,10 @@ dns_tsigkey_create(const dns_name_t *name, dst_algorithm_t algorithm,
 
                        isc_buffer_init(&b, secret, length);
                        isc_buffer_add(&b, length);
-                       result = dst_key_frombuffer(
+                       RETERR(dst_key_frombuffer(
                                name, algorithm, DNS_KEYOWNER_ENTITY,
                                DNS_KEYPROTO_DNSSEC, dns_rdataclass_in, &b,
-                               mctx, &dstkey);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                               mctx, &dstkey));
                }
        } else if (length > 0) {
                return DNS_R_BADALG;
@@ -609,11 +594,8 @@ dns_tsig_sign(dns_message_t *msg) {
                 * has validated at this point. This is why we include a
                 * MAC length > 0 in the reply.
                 */
-               result = dst_context_create(key->key, mctx,
-                                           DNS_LOGCATEGORY_DNSSEC, true, &ctx);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dst_context_create(key->key, mctx,
+                                         DNS_LOGCATEGORY_DNSSEC, true, &ctx));
 
                /*
                 * If this is a response, and if there was a TSIG in
@@ -880,26 +862,14 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
         */
 
        keyname = msg->tsigname;
-       result = dns_rdataset_first(msg->tsig);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdataset_first(msg->tsig));
        dns_rdataset_current(msg->tsig, &rdata);
-       result = dns_rdata_tostruct(&rdata, &tsig, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdata_tostruct(&rdata, &tsig, NULL));
        dns_rdata_reset(&rdata);
        if (response) {
-               result = dns_rdataset_first(msg->querytsig);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rdataset_first(msg->querytsig));
                dns_rdataset_current(msg->querytsig, &rdata);
-               result = dns_rdata_tostruct(&rdata, &querytsig, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rdata_tostruct(&rdata, &querytsig, NULL));
        }
 
        /*
@@ -940,11 +910,8 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
                if (result != ISC_R_SUCCESS) {
                        msg->tsigstatus = dns_tsigerror_badkey;
                        alg = dns__tsig_algfromname(&tsig.algorithm);
-                       result = dns_tsigkey_create(keyname, alg, NULL, 0, mctx,
-                                                   &msg->tsigkey);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(dns_tsigkey_create(keyname, alg, NULL, 0, mctx,
+                                                 &msg->tsigkey));
                        if (alg == DST_ALG_UNKNOWN) {
                                dns_name_clone(&tsig.algorithm,
                                               &msg->tsigkey->algname);
@@ -962,10 +929,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
         * Check digest length.
         */
        alg = dst_key_alg(key);
-       result = dst_key_sigsize(key, &siglen);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_sigsize(key, &siglen));
        if (dns__tsig_algvalid(alg)) {
                if (tsig.siglen > siglen) {
                        tsig_log(msg->tsigkey, 2, "signature length too big");
@@ -986,11 +950,8 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
                sig_r.base = tsig.signature;
                sig_r.length = tsig.siglen;
 
-               result = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC,
-                                           false, &ctx);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC,
+                                         false, &ctx));
 
                if (response) {
                        isc_buffer_init(&databuf, data, sizeof(data));
@@ -1220,15 +1181,9 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) {
        /*
         * Extract and parse the previous TSIG
         */
-       result = dns_rdataset_first(msg->querytsig);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdataset_first(msg->querytsig));
        dns_rdataset_current(msg->querytsig, &rdata);
-       result = dns_rdata_tostruct(&rdata, &querytsig, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_rdata_tostruct(&rdata, &querytsig, NULL));
        dns_rdata_reset(&rdata);
 
        /*
index b741a75c90561d6779b2eef44841da43c8902e2d..1927df5ab57a37dad6cf14bdd653f3f0530c7137 100644 (file)
@@ -204,17 +204,13 @@ typedef struct {
  */
 static isc_result_t
 foreach_node_rr_action(void *data, dns_rdataset_t *rdataset) {
-       isc_result_t result;
        foreach_node_rr_ctx_t *ctx = data;
        DNS_RDATASET_FOREACH(rdataset) {
                rr_t rr = { 0, DNS_RDATA_INIT };
 
                dns_rdataset_current(rdataset, &rr.rdata);
                rr.ttl = rdataset->ttl;
-               result = (*ctx->rr_action)(ctx->rr_action_data, &rr);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR((*ctx->rr_action)(ctx->rr_action_data, &rr));
        }
 
        return ISC_R_SUCCESS;
index 555e65d6a9ecfca39ba749577bc0d9b71c4a92ba..0c7122c7f32dc65f4404f28761707bf977981d92 100644 (file)
@@ -1180,13 +1180,10 @@ seek_dnskey(dns_validator_t *val) {
                         * we had a key with trust level "answer" and
                         * a DS record for the zone has now been added.
                         */
-                       result = create_validator(
+                       RETERR(create_validator(
                                val, &siginfo->signer, dns_rdatatype_dnskey,
                                &val->frdataset, &val->fsigrdataset,
-                               validator_callback_dnskey, "seek_dnskey");
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                               validator_callback_dnskey, "seek_dnskey"));
                        return DNS_R_WAIT;
                } else if (val->frdataset.trust < dns_trust_secure) {
                        /*
@@ -1223,12 +1220,8 @@ seek_dnskey(dns_validator_t *val) {
                /*
                 * We don't know anything about this key.
                 */
-               result = create_fetch(val, &siginfo->signer,
-                                     dns_rdatatype_dnskey,
-                                     fetch_callback_dnskey, "seek_dnskey");
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(create_fetch(val, &siginfo->signer, dns_rdatatype_dnskey,
+                                   fetch_callback_dnskey, "seek_dnskey"));
                return DNS_R_WAIT;
 
        case DNS_R_NCACHENXDOMAIN:
@@ -1908,11 +1901,8 @@ check_signer(dns_validator_t *val, dns_rdata_t *keyrdata, uint16_t keyid,
        dst_key_t *dstkey = NULL;
        dns_rdataset_t rdataset = DNS_RDATASET_INIT;
 
-       result = dns_dnssec_keyfromrdata(val->name, keyrdata, val->view->mctx,
-                                        &dstkey);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_dnssec_keyfromrdata(val->name, keyrdata, val->view->mctx,
+                                      &dstkey));
 
        dns_rdataset_clone(val->sigrdataset, &rdataset);
        DNS_RDATASET_FOREACH(&rdataset) {
@@ -2365,7 +2355,7 @@ static isc_result_t
 val_rdataset_first(dns_validator_t *val, dns_name_t **namep,
                   dns_rdataset_t **rdatasetp) {
        dns_message_t *message = val->message;
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
 
        REQUIRE(rdatasetp != NULL);
        REQUIRE(namep != NULL);
@@ -2378,10 +2368,7 @@ val_rdataset_first(dns_validator_t *val, dns_name_t **namep,
        }
 
        if (message != NULL) {
-               result = dns_message_firstname(message, DNS_SECTION_AUTHORITY);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_firstname(message, DNS_SECTION_AUTHORITY));
                dns_message_currentname(message, DNS_SECTION_AUTHORITY, namep);
                *rdatasetp = ISC_LIST_HEAD((*namep)->list);
                INSIST(*rdatasetp != NULL);
@@ -2391,6 +2378,7 @@ val_rdataset_first(dns_validator_t *val, dns_name_t **namep,
                        dns_ncache_current(val->rdataset, *namep, *rdatasetp);
                }
        }
+
        return result;
 }
 
@@ -2745,8 +2733,6 @@ findnsec3proofs(dns_validator_t *val) {
 static isc_result_t
 validate_neg_rrset(dns_validator_t *val, dns_name_t *name,
                   dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) {
-       isc_result_t result;
-
        /*
         * If a signed zone is missing the zone key, bad
         * things could happen.  A query for data in the zone
@@ -2763,10 +2749,7 @@ validate_neg_rrset(dns_validator_t *val, dns_name_t *name,
        {
                dns_rdata_t nsec = DNS_RDATA_INIT;
 
-               result = dns_rdataset_first(rdataset);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_rdataset_first(rdataset));
                dns_rdataset_current(rdataset, &nsec);
                if (dns_nsec_typepresent(&nsec, dns_rdatatype_soa)) {
                        return DNS_R_CONTINUE;
@@ -2774,12 +2757,9 @@ validate_neg_rrset(dns_validator_t *val, dns_name_t *name,
        }
 
        val->nxset = rdataset;
-       result = create_validator(val, name, rdataset->type, rdataset,
-                                 sigrdataset, validator_callback_nsec,
-                                 "validate_neg_rrset");
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(create_validator(val, name, rdataset->type, rdataset,
+                               sigrdataset, validator_callback_nsec,
+                               "validate_neg_rrset"));
 
        val->authcount++;
        return DNS_R_WAIT;
@@ -2984,10 +2964,7 @@ validate_nx(dns_validator_t *val, bool resume) {
        if (FOUNDNOQNAME(val) && FOUNDCLOSEST(val) &&
            ((NEEDNODATA(val) && !FOUNDNODATA(val)) || NEEDNOWILDCARD(val)))
        {
-               result = checkwildcard(val, dns_rdatatype_nsec, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(checkwildcard(val, dns_rdatatype_nsec, NULL));
        }
 
        if ((NEEDNODATA(val) && (FOUNDNODATA(val) || FOUNDOPTOUT(val))) ||
@@ -3664,7 +3641,6 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
                     isc_counter_t *nvalidations, isc_counter_t *nfails,
                     isc_counter_t *qc, isc_counter_t *gqc, fetchctx_t *parent,
                     dns_edectx_t *edectx, dns_validator_t **validatorp) {
-       isc_result_t result = ISC_R_FAILURE;
        dns_validator_t *val = NULL;
        dns_keytable_t *kt = NULL;
 
@@ -3674,10 +3650,7 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
        REQUIRE(validatorp != NULL && *validatorp == NULL);
        REQUIRE(edectx != NULL);
 
-       result = dns_view_getsecroots(view, &kt);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_view_getsecroots(view, &kt));
 
        val = isc_mem_get(view->mctx, sizeof(*val));
        *val = (dns_validator_t){
index bca4c3a7ab7c4fb57e269ad7e0fe52f46c5b1616..a640e875acc1b65fae74c5028d54d87d131da2a7 100644 (file)
@@ -537,12 +537,8 @@ dns_view_createresolver(dns_view_t *view, unsigned int options,
        REQUIRE(view->resolver == NULL);
        REQUIRE(view->dispatchmgr != NULL);
 
-       result = dns_resolver_create(view, options, tlsctx_cache, dispatchv4,
-                                    dispatchv6, &view->resolver);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
-
+       RETERR(dns_resolver_create(view, options, tlsctx_cache, dispatchv4,
+                                  dispatchv6, &view->resolver));
        isc_mem_create("ADB", &mctx);
        dns_adb_create(mctx, view, &view->adb);
        isc_mem_detach(&mctx);
@@ -1353,15 +1349,9 @@ dns_view_getpeertsig(dns_view_t *view, const isc_netaddr_t *peeraddr,
        dns_name_t *keyname = NULL;
        dns_peer_t *peer = NULL;
 
-       result = dns_peerlist_peerbyaddr(view->peers, peeraddr, &peer);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_peerlist_peerbyaddr(view->peers, peeraddr, &peer));
 
-       result = dns_peer_getkey(peer, &keyname);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_peer_getkey(peer, &keyname));
 
        result = dns_view_gettsig(view, keyname, keyp);
        return (result == ISC_R_NOTFOUND) ? ISC_R_FAILURE : result;
@@ -1378,7 +1368,6 @@ dns_view_checksig(dns_view_t *view, isc_buffer_t *source, dns_message_t *msg) {
 
 isc_result_t
 dns_view_flushcache(dns_view_t *view, bool fixuponly) {
-       isc_result_t result;
        dns_adb_t *adb = NULL;
 
        REQUIRE(DNS_VIEW_VALID(view));
@@ -1387,10 +1376,7 @@ dns_view_flushcache(dns_view_t *view, bool fixuponly) {
                return ISC_R_SUCCESS;
        }
        if (!fixuponly) {
-               result = dns_cache_flush(view->cache);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_cache_flush(view->cache));
        }
        dns_db_detach(&view->cachedb);
        dns_cache_attachdb(view->cache, &view->cachedb);
index 27f20e889180fd905288f2661f8b8165f58d0e05..aab34c0f5ff9bfa62ea6629e2360a18f04708447 100644 (file)
@@ -1526,24 +1526,16 @@ request_type(dns_xfrin_t *xfr) {
 static isc_result_t
 add_opt(dns_message_t *message, uint16_t udpsize, bool reqnsid,
        bool reqexpire) {
-       isc_result_t result;
-
        dns_message_ednsinit(message, 0, udpsize, 0, 0);
 
        /* Set EDNS options if applicable. */
        if (reqnsid) {
                dns_ednsopt_t option = { .code = DNS_OPT_NSID };
-               result = dns_message_ednsaddopt(message, &option);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_ednsaddopt(message, &option));
        }
        if (reqexpire) {
                dns_ednsopt_t option = { .code = DNS_OPT_EXPIRE };
-               result = dns_message_ednsaddopt(message, &option);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_ednsaddopt(message, &option));
        }
 
        return dns_message_setopt(message);
index 26e08945014c0fc622061847d98fc65ff9b89c3f..3b52aaaf2f45de070fdaa83c385612b9de4cf0da 100644 (file)
@@ -4540,16 +4540,11 @@ cleanup:
 static isc_result_t
 delete_keydata(dns_db_t *db, dns_dbversion_t *ver, dns_diff_t *diff,
               dns_name_t *name, dns_rdataset_t *rdataset) {
-       isc_result_t uresult;
-
        DNS_RDATASET_FOREACH(rdataset) {
                dns_rdata_t rdata = DNS_RDATA_INIT;
                dns_rdataset_current(rdataset, &rdata);
-               uresult = update_one_rr(db, ver, diff, DNS_DIFFOP_DEL, name, 0,
-                                       &rdata);
-               if (uresult != ISC_R_SUCCESS) {
-                       return uresult;
-               }
+               RETERR(update_one_rr(db, ver, diff, DNS_DIFFOP_DEL, name, 0,
+                                    &rdata));
        }
 
        return ISC_R_SUCCESS;
@@ -6930,11 +6925,8 @@ offline(dns_db_t *db, dns_dbversion_t *ver, dns__zonediff_t *zonediff,
        if ((rdata->flags & DNS_RDATA_OFFLINE) != 0) {
                return ISC_R_SUCCESS;
        }
-       result = update_one_rr(db, ver, zonediff->diff, DNS_DIFFOP_DELRESIGN,
-                              name, ttl, rdata);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(update_one_rr(db, ver, zonediff->diff, DNS_DIFFOP_DELRESIGN,
+                            name, ttl, rdata));
        rdata->flags |= DNS_RDATA_OFFLINE;
        result = update_one_rr(db, ver, zonediff->diff, DNS_DIFFOP_ADDRESIGN,
                               name, ttl, rdata);
@@ -12786,24 +12778,16 @@ create_query(dns_zone_t *zone, dns_rdatatype_t rdtype, dns_name_t *name,
 static isc_result_t
 add_opt(dns_message_t *message, uint16_t udpsize, bool reqnsid,
        bool reqexpire) {
-       isc_result_t result;
-
        dns_message_ednsinit(message, 0, udpsize, 0, 0);
 
        /* Set EDNS options if applicable. */
        if (reqnsid) {
                dns_ednsopt_t option = { .code = DNS_OPT_NSID };
-               result = dns_message_ednsaddopt(message, &option);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_ednsaddopt(message, &option));
        }
        if (reqexpire) {
                dns_ednsopt_t option = { .code = DNS_OPT_EXPIRE };
-               result = dns_message_ednsaddopt(message, &option);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_ednsaddopt(message, &option));
        }
 
        return dns_message_setopt(message);
@@ -17143,10 +17127,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) {
                return result;
        }
 
-       result = check_nsec3param(zone, db);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(check_nsec3param(zone, db));
 
        ver = NULL;
        dns_db_currentversion(db, &ver);
@@ -20128,15 +20109,11 @@ checkds_destroy(dns_checkds_t *checkds, bool locked) {
 static isc_result_t
 make_dnskey(dst_key_t *key, unsigned char *buf, int bufsize,
            dns_rdata_t *target) {
-       isc_result_t result;
        isc_buffer_t b;
        isc_region_t r;
 
        isc_buffer_init(&b, buf, bufsize);
-       result = dst_key_todns(key, &b);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dst_key_todns(key, &b));
 
        dns_rdata_reset(target);
        isc_buffer_usedregion(&b, &r);
@@ -22190,10 +22167,7 @@ dns_zone_nscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version,
        REQUIRE(DNS_ZONE_VALID(zone));
        REQUIRE(errors != NULL);
 
-       result = dns_db_getoriginnode(db, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getoriginnode(db, &node));
        result = zone_count_ns_rr(zone, db, node, version, NULL, errors, false);
        dns_db_detachnode(&node);
        return result;
@@ -22212,10 +22186,7 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
 
        REQUIRE(DNS_ZONE_VALID(zone));
 
-       result = dns_db_getoriginnode(db, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getoriginnode(db, &node));
 
        dns_rdataset_init(&cds);
        dns_rdataset_init(&dnskey);
index 95695c01eb23d15491bee3b92280dd23d60dc881..5cde1aa4f080b5ad87fb432f11505f1cfd7b3a6e 100644 (file)
@@ -704,10 +704,7 @@ verifynsec3(const vctx_t *vctx, const dns_name_t *name,
                return result;
        }
 
-       result = isoptout(vctx, &nsec3param, &optout);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isoptout(vctx, &nsec3param, &optout));
 
        dns_fixedname_init(&fixed);
        result = dns_nsec3_hashname(
@@ -772,23 +769,18 @@ verifynsec3s(const vctx_t *vctx, const dns_name_t *name,
             dns_rdataset_t *nsec3paramset, bool delegation, bool empty,
             const unsigned char types[8192], unsigned int maxtype,
             isc_result_t *vresult) {
-       isc_result_t result = ISC_R_NOMORE;
-
        DNS_RDATASET_FOREACH(nsec3paramset) {
                dns_rdata_t rdata = DNS_RDATA_INIT;
 
                dns_rdataset_current(nsec3paramset, &rdata);
-               result = verifynsec3(vctx, name, &rdata, delegation, empty,
-                                    types, maxtype, vresult);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(verifynsec3(vctx, name, &rdata, delegation, empty, types,
+                                  maxtype, vresult));
                if (*vresult != ISC_R_SUCCESS) {
                        break;
                }
        }
 
-       return result;
+       return ISC_R_SUCCESS;
 }
 
 static isc_result_t
@@ -970,19 +962,13 @@ verifynode(vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node,
        *vresult = ISC_R_SUCCESS;
 
        if (nsecset != NULL && dns_rdataset_isassociated(nsecset)) {
-               result = verifynsec(vctx, name, node, nextname, &tvresult);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(verifynsec(vctx, name, node, nextname, &tvresult));
                *vresult = tvresult;
        }
 
        if (nsec3paramset != NULL && dns_rdataset_isassociated(nsec3paramset)) {
-               result = verifynsec3s(vctx, name, nsec3paramset, delegation,
-                                     false, types, maxtype, &tvresult);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(verifynsec3s(vctx, name, nsec3paramset, delegation,
+                                   false, types, maxtype, &tvresult));
                if (*vresult == ISC_R_SUCCESS) {
                        *vresult = tvresult;
                }
@@ -1217,7 +1203,7 @@ verifyemptynodes(const vctx_t *vctx, const dns_name_t *name,
        int order;
        unsigned int labels, nlabels, i;
        dns_name_t suffix;
-       isc_result_t result, tvresult = ISC_R_UNSET;
+       isc_result_t tvresult = ISC_R_UNSET;
 
        *vresult = ISC_R_SUCCESS;
 
@@ -1238,12 +1224,9 @@ verifyemptynodes(const vctx_t *vctx, const dns_name_t *name,
                        if (nsec3paramset != NULL &&
                            dns_rdataset_isassociated(nsec3paramset))
                        {
-                               result = verifynsec3s(
-                                       vctx, &suffix, nsec3paramset,
-                                       isdelegation, true, NULL, 0, &tvresult);
-                               if (result != ISC_R_SUCCESS) {
-                                       return result;
-                               }
+                               RETERR(verifynsec3s(vctx, &suffix,
+                                                   nsec3paramset, isdelegation,
+                                                   true, NULL, 0, &tvresult));
                                if (*vresult == ISC_R_SUCCESS) {
                                        *vresult = tvresult;
                                }
index fdbcbb46e3a566a073834c266fe677863f5830f0..513f85a92dcc263eb2a7ef0cca4f5de516156d01 100644 (file)
@@ -211,8 +211,6 @@ isc_commandline_parse(int argc, char *const *argv, const char *options) {
 isc_result_t
 isc_commandline_strtoargv(isc_mem_t *mctx, char *s, unsigned int *argcp,
                          char ***argvp, unsigned int n) {
-       isc_result_t result;
-
 restart:
        /* Discard leading whitespace. */
        while (*s == ' ' || *s == '\t') {
@@ -256,11 +254,7 @@ restart:
                        *p++ = '\0';
                }
 
-               result = isc_commandline_strtoargv(mctx, p, argcp, argvp,
-                                                  n + 1);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(isc_commandline_strtoargv(mctx, p, argcp, argvp, n + 1));
                (*argvp)[n] = s;
        }
 
index fe027ae24c03cbef0294f35a079ab90a22f7eebe..fbf0b80fb1f18da8c7d72ae6c24b631d06017dcf 100644 (file)
@@ -576,15 +576,13 @@ dir_current(char *dirname, size_t length) {
 
 isc_result_t
 isc_file_absolutepath(const char *filename, char *path, size_t pathlen) {
-       isc_result_t result;
-       result = dir_current(path, pathlen);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dir_current(path, pathlen));
+
        if (strlen(path) + strlen(filename) + 1 > pathlen) {
                return ISC_R_NOSPACE;
        }
        strlcat(path, filename, pathlen);
+
        return ISC_R_SUCCESS;
 }
 
@@ -697,7 +695,6 @@ isc_file_sanitize(const char *dir, const char *base, const char *ext,
        unsigned int digestlen;
        char hash[ISC_MAX_MD_SIZE * 2 + 1];
        size_t l = 0;
-       isc_result_t err;
 
        REQUIRE(base != NULL);
        REQUIRE(path != NULL);
@@ -724,16 +721,10 @@ isc_file_sanitize(const char *dir, const char *base, const char *ext,
        }
 
        /* Check whether the full-length SHA256 hash filename exists */
-       err = isc_md(ISC_MD_SHA256, (const unsigned char *)base, strlen(base),
-                    digest, &digestlen);
-       if (err != ISC_R_SUCCESS) {
-               return err;
-       }
+       RETERR(isc_md(ISC_MD_SHA256, (const unsigned char *)base, strlen(base),
+                     digest, &digestlen));
 
-       err = digest2hex(digest, digestlen, hash, sizeof(hash));
-       if (err != ISC_R_SUCCESS) {
-               return err;
-       }
+       RETERR(digest2hex(digest, digestlen, hash, sizeof(hash)));
 
        snprintf(buf, sizeof(buf), "%s%s%s%s%s", dir != NULL ? dir : "",
                 dir != NULL ? "/" : "", hash, ext != NULL ? "." : "",
index e77ef7a085e18fa6da30220272a7e4e6ac60e21f..ff9922d066e9b15b1de419bcebc17dddca5d1cc4 100644 (file)
@@ -81,14 +81,8 @@ isc_getaddresses(const char *hostname, in_port_t port, isc_sockaddr_t *addrs,
                        }
 
                        if (d != NULL) {
-                               isc_result_t iresult;
-
-                               iresult = isc_netscope_pton(AF_INET6, d + 1,
-                                                           &in6, &zone);
-
-                               if (iresult != ISC_R_SUCCESS) {
-                                       return iresult;
-                               }
+                               RETERR(isc_netscope_pton(AF_INET6, d + 1, &in6,
+                                                        &zone));
                        }
 
                        isc_netaddr_fromin6(&na, &in6);
index 7cf51567e50993477546797dea960a7b419ce61f..13b3d55a63397c5ed7845d3507b6da2d278d95f5 100644 (file)
@@ -361,7 +361,6 @@ process_request(isc_httpd_t *httpd, size_t last_len) {
        size_t path_len = 0;
        struct phr_header headers[HTTP_HEADERS_NUM];
        size_t num_headers;
-       isc_result_t result;
 
        num_headers = ARRAY_SIZE(headers);
 
@@ -401,10 +400,7 @@ process_request(isc_httpd_t *httpd, size_t last_len) {
        /*
         * Parse the URL
         */
-       result = isc_url_parse(path, path_len, 0, &httpd->up);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_url_parse(path, path_len, 0, &httpd->up));
        httpd->path = path;
 
        /*
index 75754bf08e5365e3b82fadd388eeade4bb5b6529..3987fef8247b8f4a5a2ecfd638ded4996e9b59db 100644 (file)
@@ -1190,16 +1190,11 @@ isc_buffer_dup(isc_mem_t *mctx, isc_buffer_t **restrict dstp,
 static inline isc_result_t
 isc_buffer_copyregion(isc_buffer_t *restrict b,
                      const isc_region_t *restrict r) {
-       isc_result_t result;
-
        REQUIRE(ISC_BUFFER_VALID(b));
        REQUIRE(r != NULL);
 
        if (b->mctx) {
-               result = isc_buffer_reserve(b, r->length);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(isc_buffer_reserve(b, r->length));
        }
 
        if (r->length > isc_buffer_availablelength(b)) {
@@ -1216,9 +1211,8 @@ isc_buffer_copyregion(isc_buffer_t *restrict b,
 
 static inline isc_result_t
 isc_buffer_printf(isc_buffer_t *restrict b, const char *restrict format, ...) {
-       va_list      ap;
-       int          n;
-       isc_result_t result;
+       va_list ap;
+       int     n;
 
        REQUIRE(ISC_BUFFER_VALID(b));
 
@@ -1231,10 +1225,7 @@ isc_buffer_printf(isc_buffer_t *restrict b, const char *restrict format, ...) {
        }
 
        if (b->mctx) {
-               result = isc_buffer_reserve(b, n + 1);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(isc_buffer_reserve(b, n + 1));
        }
 
        if (isc_buffer_availablelength(b) < (unsigned int)n + 1) {
index e38947cbdd551e2f043649be79a6862329fab1fd..588ffa6bf1ef525ec0c9ba8e62806b04a0fb3949 100644 (file)
@@ -200,7 +200,6 @@ new_source(isc_lex_t *lex, bool is_file, bool need_close, void *input,
 
 isc_result_t
 isc_lex_openfile(isc_lex_t *lex, const char *filename) {
-       isc_result_t result;
        FILE *stream = NULL;
 
        /*
@@ -209,10 +208,7 @@ isc_lex_openfile(isc_lex_t *lex, const char *filename) {
 
        REQUIRE(VALID_LEX(lex));
 
-       result = isc_stdio_open(filename, "r", &stream);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_stdio_open(filename, "r", &stream));
 
        new_source(lex, true, true, stream, filename);
        return ISC_R_SUCCESS;
index ad984c0068874e209cc297ba8c6c9b9d33f91d7f..5893eb4a862640d1622c9ff7d6491090e1042379 100644 (file)
@@ -796,14 +796,7 @@ greatest_version(isc_logfile_t *file, int versions, int *greatestp) {
        bnamelen = strlen(bname);
 
        isc_dir_init(&dir);
-       result = isc_dir_open(&dir, dirname);
-
-       /*
-        * Return if the directory open failed.
-        */
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_dir_open(&dir, dirname));
 
        while (isc_dir_read(&dir) == ISC_R_SUCCESS) {
                if (dir.entry.length > bnamelen &&
@@ -943,14 +936,7 @@ remove_old_tsversions(isc_logfile_t *file, int versions) {
        bnamelen = strlen(bname);
 
        isc_dir_init(&dir);
-       result = isc_dir_open(&dir, dirname);
-
-       /*
-        * Return if the directory open failed.
-        */
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_dir_open(&dir, dirname));
 
        last = last_to_keep(versions, &dir, bname, bnamelen);
 
@@ -1023,10 +1009,7 @@ roll_increment(isc_logfile_t *file) {
                 * Get the largest existing version and remove any
                 * version greater than the permitted version.
                 */
-               result = greatest_version(file, file->versions, &greatest);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(greatest_version(file, file->versions, &greatest));
 
                /*
                 * Increment if greatest is not the actual maximum value.
index bb3cb67045a80080941f8e12757a9c1e27f7de80..7922683bdc91f3b742be25e4fb675abe3893c066 100644 (file)
@@ -281,18 +281,14 @@ isc_nm_listenudp(uint32_t workers, isc_sockaddr_t *iface, isc_nm_recv_cb_t cb,
 #ifdef USE_ROUTE_SOCKET
 static isc_result_t
 route_socket(uv_os_sock_t *fdp) {
-       isc_result_t result;
        uv_os_sock_t fd = -1;
 #ifdef USE_NETLINK
        struct sockaddr_nl sa;
        int r;
 #endif
 
-       result = isc__nm_socket(ROUTE_SOCKET_PF, SOCK_RAW,
-                               ROUTE_SOCKET_PROTOCOL, &fd);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc__nm_socket(ROUTE_SOCKET_PF, SOCK_RAW, ROUTE_SOCKET_PROTOCOL,
+                             &fd));
 
 #ifdef USE_NETLINK
        sa.nl_family = PF_NETLINK;
@@ -361,10 +357,7 @@ isc_nm_routeconnect(isc_nm_cb_t cb, void *cbarg) {
                return ISC_R_SHUTTINGDOWN;
        }
 
-       result = route_socket(&fd);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(route_socket(&fd));
 
        sock = isc_mempool_get(worker->nmsocket_pool);
        isc__nmsocket_init(sock, worker, isc_nm_udpsocket, NULL, NULL);
index 001fe9d4166ff0fae55562f432f3bf5c133b9f3b..d9887aef1df21065dc64735b59f71b907f7c7d8c 100644 (file)
@@ -51,11 +51,8 @@ isc_parse_uint32(uint32_t *uip, const char *string, int base) {
 isc_result_t
 isc_parse_uint16(uint16_t *uip, const char *string, int base) {
        uint32_t val;
-       isc_result_t result;
-       result = isc_parse_uint32(&val, string, base);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+
+       RETERR(isc_parse_uint32(&val, string, base));
        if (val > 0xFFFF) {
                return ISC_R_RANGE;
        }
@@ -66,11 +63,8 @@ isc_parse_uint16(uint16_t *uip, const char *string, int base) {
 isc_result_t
 isc_parse_uint8(uint8_t *uip, const char *string, int base) {
        uint32_t val;
-       isc_result_t result;
-       result = isc_parse_uint32(&val, string, base);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+
+       RETERR(isc_parse_uint32(&val, string, base));
        if (val > 0xFF) {
                return ISC_R_RANGE;
        }
index 7837b6552805e0276dfea468b44a771b8e2ffe9b..5c9644097adfe8e8b9fd0e227636b07651ee4428 100644 (file)
@@ -673,7 +673,6 @@ isc_proxy2_handler_addresses(const isc_proxy2_handler_t *restrict handler,
                             int *restrict psocktype,
                             isc_sockaddr_t *restrict psrc_addr,
                             isc_sockaddr_t *restrict pdst_addr) {
-       isc_result_t result;
        size_t ret;
        isc_region_t header_region = { 0 };
        isc_buffer_t buf = { 0 };
@@ -693,12 +692,8 @@ isc_proxy2_handler_addresses(const isc_proxy2_handler_t *restrict handler,
 
        INSIST(handler->expect_data == 0);
 
-       result = isc__proxy2_handler_get_addresses(
-               (isc_proxy2_handler_t *)handler, &buf, psrc_addr, pdst_addr);
-
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc__proxy2_handler_get_addresses(
+               (isc_proxy2_handler_t *)handler, &buf, psrc_addr, pdst_addr));
 
        SET_IF_NOT_NULL(psocktype,
                        proxy2_socktype_to_socktype(handler->proxy_socktype));
@@ -840,12 +835,8 @@ isc_proxy2_subtlv_tls_iterate(const isc_region_t *restrict tls_tlv_data,
                return ISC_R_RANGE;
        }
 
-       result = isc_proxy2_subtlv_tls_header_data(tls_tlv_data, &client_flags,
-                                                  &client_cert_verified);
-
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_proxy2_subtlv_tls_header_data(tls_tlv_data, &client_flags,
+                                                &client_cert_verified));
 
        p = tls_tlv_data->base;
        p += ISC_PROXY2_TLS_SUBHEADER_MIN_SIZE;
@@ -1041,14 +1032,10 @@ error_range:
 
 isc_result_t
 isc_proxy2_tlv_data_verify(const isc_region_t *restrict tlv_data) {
-       isc_result_t result;
        tlv_verify_cbarg_t cbarg = { .verify_result = ISC_R_SUCCESS };
 
-       result = isc_proxy2_tlv_iterate(tlv_data, isc_proxy2_tlv_verify_cb,
-                                       &cbarg);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_proxy2_tlv_iterate(tlv_data, isc_proxy2_tlv_verify_cb,
+                                     &cbarg));
 
        return cbarg.verify_result;
 }
index 31cceed1b01c974f6de5f802b676a364afec05d2..afa38ea45366aa622241bd5d0995017870f9c7d3 100644 (file)
@@ -450,11 +450,7 @@ isc_radix_insert(isc_radix_tree_t *radix, isc_radix_node_t **target,
                        *target = node;
                        return ISC_R_SUCCESS;
                } else {
-                       result = _ref_prefix(radix->mctx, &node->prefix,
-                                            prefix);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(_ref_prefix(radix->mctx, &node->prefix, prefix));
                }
                INSIST(node->data[RADIX_V4] == NULL &&
                       node->node_num[RADIX_V4] == -1 &&
index f09d8aacbc3a700fd3c7246e8b2918f439b8067b..cd1d7eb74fbe1a4e540d50364da9f1d53b2783f9 100644 (file)
@@ -114,7 +114,6 @@ isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b,
 
 isc_result_t
 isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
-       isc_result_t result;
        isc_netaddr_t netaddr;
        char pbuf[sizeof("65000")];
        unsigned int plen;
@@ -144,10 +143,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
        INSIST(plen < sizeof(pbuf));
 
        isc_netaddr_fromsockaddr(&netaddr, sockaddr);
-       result = isc_netaddr_totext(&netaddr, target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_netaddr_totext(&netaddr, target));
 
        if (1 + plen + 1 > isc_buffer_availablelength(target)) {
                return ISC_R_NOSPACE;
index 6ba4cb49916de1a452133f8e095269f4222d20a6..eaa10129b0d08d7b108cbf837907e88bdb33b107 100644 (file)
@@ -622,12 +622,7 @@ isc_url_parse(const char *buf, size_t buflen, bool is_connect,
        }
 
        if (up->field_set & (1 << ISC_UF_HOST)) {
-               isc_result_t result;
-
-               result = http_parse_host(buf, up, found_at);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(http_parse_host(buf, up, found_at));
        }
 
        /* CONNECT requests can only contain "hostname:port" */
index 3ead3633e7221726d40b3b2387038e98c89729dc..73f65641f55beb9011f569ac6cafed56be1d5bb3 100644 (file)
@@ -42,17 +42,13 @@ isccc_base64_encode(isccc_region_t *source, int wordlength,
                    const char *wordbreak, isccc_region_t *target) {
        isc_region_t sr;
        isc_buffer_t tb;
-       isc_result_t result;
 
        sr.base = source->rstart;
        sr.length = (unsigned int)(source->rend - source->rstart);
        isc_buffer_init(&tb, target->rstart,
                        (unsigned int)(target->rend - target->rstart));
 
-       result = isc_base64_totext(&sr, wordlength, wordbreak, &tb);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_base64_totext(&sr, wordlength, wordbreak, &tb));
        source->rstart = source->rend;
        target->rstart = isc_buffer_used(&tb);
        return ISC_R_SUCCESS;
@@ -61,14 +57,10 @@ isccc_base64_encode(isccc_region_t *source, int wordlength,
 isc_result_t
 isccc_base64_decode(const char *cstr, isccc_region_t *target) {
        isc_buffer_t b;
-       isc_result_t result;
 
        isc_buffer_init(&b, target->rstart,
                        (unsigned int)(target->rend - target->rstart));
-       result = isc_base64_decodestring(cstr, &b);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_base64_decodestring(cstr, &b));
        target->rstart = isc_buffer_used(&b);
        return ISC_R_SUCCESS;
 }
index 2df9305f36b4de0e9387239e5b38cf658658a993..a8f1a759affb79773d1ffa5b305d0d5af8b55e60 100644 (file)
@@ -146,10 +146,7 @@ value_towire(isccc_sexpr_t *elt, isc_buffer_t **buffer) {
                /*
                 * Emit the table.
                 */
-               result = table_towire(elt, buffer);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(table_towire(elt, buffer));
 
                len = (*buffer)->used - used;
                /*
@@ -180,10 +177,7 @@ value_towire(isccc_sexpr_t *elt, isc_buffer_t **buffer) {
                /*
                 * Emit the list.
                 */
-               result = list_towire(elt, buffer);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(list_towire(elt, buffer));
 
                len = (*buffer)->used - used;
                /*
@@ -229,10 +223,7 @@ table_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer) {
                /*
                 * Emit the value.
                 */
-               result = value_towire(v, buffer);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(value_towire(v, buffer));
        }
 
        return ISC_R_SUCCESS;
@@ -240,13 +231,8 @@ table_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer) {
 
 static isc_result_t
 list_towire(isccc_sexpr_t *list, isc_buffer_t **buffer) {
-       isc_result_t result;
-
        while (list != NULL) {
-               result = value_towire(ISCCC_SEXPR_CAR(list), buffer);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(value_towire(ISCCC_SEXPR_CAR(list), buffer));
                list = ISCCC_SEXPR_CDR(list);
        }
 
@@ -257,7 +243,6 @@ static isc_result_t
 sign(unsigned char *data, unsigned int length, unsigned char *out,
      uint32_t algorithm, isccc_region_t *secret) {
        const isc_md_type_t *md_type;
-       isc_result_t result;
        isccc_region_t source, target;
        unsigned char digest[ISC_MAX_MD_SIZE];
        unsigned int digestlen = sizeof(digest);
@@ -288,20 +273,14 @@ sign(unsigned char *data, unsigned int length, unsigned char *out,
                return ISC_R_NOTIMPLEMENTED;
        }
 
-       result = isc_hmac(md_type, secret->rstart, REGION_SIZE(*secret), data,
-                         length, digest, &digestlen);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_hmac(md_type, secret->rstart, REGION_SIZE(*secret), data,
+                       length, digest, &digestlen));
        source.rend = digest + digestlen;
 
        memset(digestb64, 0, sizeof(digestb64));
        target.rstart = digestb64;
        target.rend = digestb64 + sizeof(digestb64);
-       result = isccc_base64_encode(&source, 64, "", &target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isccc_base64_encode(&source, 64, "", &target));
        if (algorithm == ISCCC_ALG_HMACMD5) {
                PUT_MEM(digestb64, HMD5_LENGTH, out);
        } else {
@@ -361,10 +340,7 @@ isccc_cc_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer, uint32_t algorithm,
        /*
         * Emit the message.
         */
-       result = table_towire(alist, buffer);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(table_towire(alist, buffer));
        if (secret != NULL) {
                return sign((unsigned char *)(*buffer)->base + signed_base,
                            (*buffer)->used - signed_base,
@@ -380,7 +356,6 @@ verify(isccc_sexpr_t *alist, unsigned char *data, unsigned int length,
        const isc_md_type_t *md_type;
        isccc_region_t source;
        isccc_region_t target;
-       isc_result_t result;
        isccc_sexpr_t *_auth, *hmacvalue;
        unsigned char digest[ISC_MAX_MD_SIZE];
        unsigned int digestlen = sizeof(digest);
@@ -429,20 +404,14 @@ verify(isccc_sexpr_t *alist, unsigned char *data, unsigned int length,
                return ISC_R_NOTIMPLEMENTED;
        }
 
-       result = isc_hmac(md_type, secret->rstart, REGION_SIZE(*secret), data,
-                         length, digest, &digestlen);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_hmac(md_type, secret->rstart, REGION_SIZE(*secret), data,
+                       length, digest, &digestlen));
        source.rend = digest + digestlen;
 
        target.rstart = digestb64;
        target.rend = digestb64 + sizeof(digestb64);
        memset(digestb64, 0, sizeof(digestb64));
-       result = isccc_base64_encode(&source, 64, "", &target);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isccc_base64_encode(&source, 64, "", &target));
 
        /*
         * Verify.
@@ -752,10 +721,7 @@ isccc_cc_createack(isccc_sexpr_t *message, bool ok, isccc_sexpr_t **ackp) {
         * Create the ack.
         */
        ack = NULL;
-       result = createmessage(1, _to, _frm, serial, t, 0, &ack, false);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(createmessage(1, _to, _frm, serial, t, 0, &ack, false));
 
        _ctrl = isccc_alist_lookup(ack, "_ctrl");
        if (_ctrl == NULL) {
@@ -834,11 +800,8 @@ isccc_cc_createresponse(isccc_sexpr_t *message, isccc_time_t now,
         * Create the response.
         */
        alist = NULL;
-       result = isccc_cc_createmessage(1, _to, _frm, serial, now, expires,
-                                       &alist);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isccc_cc_createmessage(1, _to, _frm, serial, now, expires,
+                                     &alist));
 
        _ctrl = isccc_alist_lookup(alist, "_ctrl");
        if (_ctrl == NULL) {
index 8dfb769606dfa2022f3355163f34fc551a530bd7..9324e7a5f728782888dd45a248355801228915bc 100644 (file)
@@ -75,13 +75,9 @@ ISC_REFCOUNT_IMPL(cfg_aclconfctx, destroy_aclctx);
  */
 static isc_result_t
 get_acl_def(const cfg_obj_t *cctx, const char *name, const cfg_obj_t **ret) {
-       isc_result_t result;
        const cfg_obj_t *acls = NULL;
 
-       result = cfg_map_get(cctx, "acl", &acls);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(cfg_map_get(cctx, "acl", &acls));
        CFG_LIST_FOREACH(acls, elt) {
                const cfg_obj_t *acl = cfg_listelt_value(elt);
                const char *aclname =
@@ -202,11 +198,8 @@ count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx,
                } else if (cfg_obj_islist(ce)) {
                        bool negative;
                        uint32_t sub;
-                       result = count_acl_elements(ce, cctx, ctx, mctx, &sub,
-                                                   &negative);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(count_acl_elements(ce, cctx, ctx, mctx, &sub,
+                                                 &negative));
                        n += sub;
                        if (negative) {
                                n++;
@@ -642,11 +635,8 @@ cfg_acl_fromconfig(const cfg_obj_t *acl_data, const cfg_obj_t *cctx,
                uint32_t nelem;
 
                if (nest_level == 0) {
-                       result = count_acl_elements(caml, cctx, ctx, mctx,
-                                                   &nelem, NULL);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(count_acl_elements(caml, cctx, ctx, mctx, &nelem,
+                                                 NULL));
                } else {
                        nelem = cfg_list_length(caml, false);
                }
index 8a64bbf24206eed7ef6a21fa9d5dbcd541e78005..654e45a2b3b2a40546eaab45bd49af486b405753 100644 (file)
@@ -315,16 +315,12 @@ check_forward(const cfg_obj_t *config, const cfg_obj_t *options,
                return ISC_R_FAILURE;
        }
        if (forwarders != NULL) {
-               isc_result_t result = ISC_R_SUCCESS;
                const cfg_obj_t *tlspobj = cfg_tuple_get(forwarders, "tls");
 
                if (tlspobj != NULL && cfg_obj_isstring(tlspobj)) {
                        const char *tls = cfg_obj_asstring(tlspobj);
                        if (tls != NULL) {
-                               result = validate_tls(config, tlspobj, tls);
-                               if (result != ISC_R_SUCCESS) {
-                                       return result;
-                               }
+                               RETERR(validate_tls(config, tlspobj, tls));
                        }
                }
 
@@ -333,10 +329,7 @@ check_forward(const cfg_obj_t *config, const cfg_obj_t *options,
                        const cfg_obj_t *forwarder = cfg_listelt_value(element);
                        const char *tls = cfg_obj_getsockaddrtls(forwarder);
                        if (tls != NULL) {
-                               result = validate_tls(config, faddresses, tls);
-                               if (result != ISC_R_SUCCESS) {
-                                       return result;
-                               }
+                               RETERR(validate_tls(config, faddresses, tls));
                        }
                }
        }
@@ -2380,13 +2373,9 @@ check_tls_definitions(const cfg_obj_t *config, isc_mem_t *mctx) {
 static isc_result_t
 get_remotes(const cfg_obj_t *cctx, const char *list, const char *name,
            const cfg_obj_t **ret) {
-       isc_result_t result = ISC_R_SUCCESS;
        const cfg_obj_t *obj = NULL;
 
-       result = cfg_map_get(cctx, list, &obj);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(cfg_map_get(cctx, list, &obj));
 
        CFG_LIST_FOREACH(obj, elt) {
                const char *listname = NULL;
@@ -4490,10 +4479,7 @@ check_keylist(const cfg_obj_t *keys, isc_symtab_t *symtab, isc_mem_t *mctx) {
                        result = tresult;
                        continue;
                }
-               tresult = isccfg_check_key(key);
-               if (tresult != ISC_R_SUCCESS) {
-                       return tresult;
-               }
+               RETERR(isccfg_check_key(key));
 
                dns_name_format(name, namebuf, sizeof(namebuf));
                keyname = isc_mem_strdup(mctx, namebuf);
index 8385767c6df83599ba942e99df48fd81703d80f2..0d80cc70ee48c5a2ca8a3433b968706fe3a7d35a 100644 (file)
@@ -436,16 +436,11 @@ cfg_parser_currentfile(cfg_parser_t *pctx) {
 
 isc_result_t
 cfg_parse_obj(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
-       isc_result_t result;
-
        REQUIRE(pctx != NULL);
        REQUIRE(type != NULL);
        REQUIRE(ret != NULL && *ret == NULL);
 
-       result = type->parse(pctx, type, ret);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(type->parse(pctx, type, ret));
        ENSURE(*ret != NULL);
        return ISC_R_SUCCESS;
 }
@@ -2007,17 +2002,13 @@ cfg_obj_asboolean(const cfg_obj_t *obj) {
 isc_result_t
 cfg_parse_boolean(cfg_parser_t *pctx, const cfg_type_t *type ISC_ATTR_UNUSED,
                  cfg_obj_t **ret) {
-       isc_result_t result;
        bool value;
        cfg_obj_t *obj = NULL;
 
        REQUIRE(pctx != NULL);
        REQUIRE(ret != NULL && *ret == NULL);
 
-       result = cfg_gettoken(pctx, 0);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(cfg_gettoken(pctx, 0));
 
        if (pctx->token.type != isc_tokentype_string) {
                goto bad_boolean;
@@ -2891,7 +2882,6 @@ cfg_obj_ismap(const cfg_obj_t *obj) {
 
 isc_result_t
 cfg_map_get(const cfg_obj_t *mapobj, const char *name, const cfg_obj_t **obj) {
-       isc_result_t result;
        isc_symvalue_t val;
        const cfg_map_t *map;
 
@@ -2901,10 +2891,7 @@ cfg_map_get(const cfg_obj_t *mapobj, const char *name, const cfg_obj_t **obj) {
 
        map = &mapobj->value.map;
 
-       result = isc_symtab_lookup(map->symtab, name, SYMTAB_DUMMY_TYPE, &val);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_symtab_lookup(map->symtab, name, SYMTAB_DUMMY_TYPE, &val));
        *obj = val.as_pointer;
        return ISC_R_SUCCESS;
 }
@@ -3143,13 +3130,8 @@ token_addr(cfg_parser_t *pctx, unsigned int flags, isc_netaddr_t *na) {
 
                        if (inet_pton(AF_INET6, buf, &in6a) == 1) {
                                if (d != NULL) {
-                                       isc_result_t result;
-
-                                       result = isc_netscope_pton(
-                                               AF_INET6, d + 1, &in6a, &zone);
-                                       if (result != ISC_R_SUCCESS) {
-                                               return result;
-                                       }
+                                       RETERR(isc_netscope_pton(
+                                               AF_INET6, d + 1, &in6a, &zone));
                                }
 
                                isc_netaddr_fromin6(na, &in6a);
@@ -3769,12 +3751,7 @@ cleanup:
  */
 static isc_result_t
 cfg_getstringtoken(cfg_parser_t *pctx) {
-       isc_result_t result;
-
-       result = cfg_gettoken(pctx, CFG_LEXOPT_QSTRING);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(cfg_gettoken(pctx, CFG_LEXOPT_QSTRING));
 
        if (pctx->token.type != isc_tokentype_string &&
            pctx->token.type != isc_tokentype_qstring)
index a99857bed4dc91eebcf3ef6c8249b3575762d0cb..d35891d45b16ff9fd80f2da29113d20d3448c93c 100644 (file)
@@ -1074,10 +1074,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message) {
                                .value = (unsigned char *)nsidp,
                                .length = (uint16_t)strlen(nsidp),
                        };
-                       result = dns_message_ednsaddopt(message, &option);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(dns_message_ednsaddopt(message, &option));
                }
        }
 
@@ -1093,10 +1090,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message) {
                dns_ednsopt_t option = { .code = DNS_OPT_COOKIE,
                                         .length = COOKIE_SIZE,
                                         .value = cookie };
-               result = dns_message_ednsaddopt(message, &option);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_ednsaddopt(message, &option));
        }
 
        if ((client->inner.attributes & NS_CLIENTATTR_HAVEEXPIRE) != 0) {
@@ -1108,10 +1102,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message) {
                dns_ednsopt_t option = { .code = DNS_OPT_EXPIRE,
                                         .value = expire,
                                         .length = 4 };
-               result = dns_message_ednsaddopt(message, &option);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_ednsaddopt(message, &option));
        }
 
        if (((client->inner.attributes & NS_CLIENTATTR_HAVEECS) != 0) &&
@@ -1170,10 +1161,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message) {
                dns_ednsopt_t option = { .code = DNS_OPT_CLIENT_SUBNET,
                                         .length = addrl + 4,
                                         .value = ecs };
-               result = dns_message_ednsaddopt(message, &option);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_ednsaddopt(message, &option));
        }
 
        if (TCP_CLIENT(client) && USEKEEPALIVE(client)) {
@@ -1187,10 +1175,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message) {
                dns_ednsopt_t option = { .code = DNS_OPT_TCP_KEEPALIVE,
                                         .length = 2,
                                         .value = advtimo };
-               result = dns_message_ednsaddopt(message, &option);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_ednsaddopt(message, &option));
        }
 
        for (size_t i = 0; i < DNS_EDE_MAX_ERRORS; i++) {
@@ -1203,10 +1188,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message) {
                dns_ednsopt_t option = { .code = DNS_OPT_EDE,
                                         .length = ede->length,
                                         .value = ede->value };
-               result = dns_message_ednsaddopt(message, &option);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_ednsaddopt(message, &option));
        }
        if ((client->inner.attributes & NS_CLIENTATTR_HAVEZONEVERSION) != 0) {
                dns_ednsopt_t option = {
@@ -1214,10 +1196,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message) {
                        .length = client->inner.zoneversionlength,
                        .value = client->inner.zoneversion
                };
-               result = dns_message_ednsaddopt(message, &option);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_message_ednsaddopt(message, &option));
        }
 
        if (WANTRC(client)) {
@@ -1231,10 +1210,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message) {
                                .length = rad->length,
                                .value = rad->ndata,
                        };
-                       result = dns_message_ednsaddopt(message, &option);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(dns_message_ednsaddopt(message, &option));
                }
        }
 
index 9cc1a74be8d6e53a17ee9fbe516a3fb7326daa5d..71ffda00460abcff5ce0d52f1aa5a10954390c42 100644 (file)
@@ -840,11 +840,8 @@ setup_locals(isc_interface_t *interface, dns_acl_t *localhost,
 
        /* First add localhost address */
        prefixlen = (netaddr->family == AF_INET) ? 32 : 128;
-       result = dns_iptable_addprefix(localhost->iptable, netaddr, prefixlen,
-                                      true);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_iptable_addprefix(localhost->iptable, netaddr, prefixlen,
+                                    true));
 
        /* Then add localnets prefix */
        result = isc_netaddr_masktoprefixlen(&interface->netmask, &prefixlen);
@@ -873,11 +870,8 @@ setup_locals(isc_interface_t *interface, dns_acl_t *localhost,
                return ISC_R_SUCCESS;
        }
 
-       result = dns_iptable_addprefix(localnets->iptable, netaddr, prefixlen,
-                                      true);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_iptable_addprefix(localnets->iptable, netaddr, prefixlen,
+                                    true));
 
        return ISC_R_SUCCESS;
 }
@@ -1083,10 +1077,7 @@ do_scan(ns_interfacemgr_t *mgr, bool verbose, bool config) {
        isc_netaddr_any(&zero_address);
        isc_netaddr_any6(&zero_address6);
 
-       result = isc_interfaceiter_create(mgr->mctx, &iter);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_interfaceiter_create(mgr->mctx, &iter));
 
        dns_acl_create(mgr->mctx, 0, &localhost);
        dns_acl_create(mgr->mctx, 0, &localnets);
index a5ee19f3542840ba717adda90b3a90ae5c7fe13f..b9e7ebec636a278ce895a1047d163360de740484 100644 (file)
@@ -1774,11 +1774,8 @@ query_additionalauth(query_ctx_t *qctx, const dns_name_t *name,
                version = NULL;
                dns_db_detach(&db);
                dns_getdb_options_t options = { .nolog = true };
-               result = query_getzonedb(client, name, type, options, &zone,
-                                        &db, &version);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(query_getzonedb(client, name, type, options, &zone, &db,
+                                      &version));
                dns_zone_detach(&zone);
 
                CTRACE(ISC_LOG_DEBUG(3), "query_additionalauth: other zone");
@@ -3734,11 +3731,8 @@ rpz_rewrite_ip_rrset(ns_client_t *client, dns_name_t *name,
                                continue;
                        }
 
-                       result = rpz_rewrite_ip(client, &netaddr, qtype,
-                                               rpz_type, zbits, p_rdatasetp);
-                       if (result != ISC_R_SUCCESS) {
-                               return result;
-                       }
+                       RETERR(rpz_rewrite_ip(client, &netaddr, qtype, rpz_type,
+                                             zbits, p_rdatasetp));
                }
        } while (!done &&
                 client->query.rpz_st->m.policy == DNS_RPZ_POLICY_MISS);
@@ -6344,10 +6338,7 @@ ns_query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
                inc_stats(client, ns_statscounter_recursion);
        }
 
-       result = acquire_recursionquota(client);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(acquire_recursionquota(client));
 
        /*
         * Invoke the resolver.
@@ -9558,10 +9549,7 @@ query_synthcnamewildcard(query_ctx_t *qctx, dns_rdataset_t *rdataset,
        dns_rdata_t rdata = DNS_RDATA_INIT;
        dns_rdata_cname_t cname;
 
-       result = query_synthwildcard(qctx, rdataset, sigrdataset);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(query_synthwildcard(qctx, rdataset, sigrdataset));
 
        qctx->client->query.attributes |= NS_QUERYATTR_PARTIALANSWER;
 
index a88e1c245b354eabb901ee6a4983b59dfece549d..64366b961c10babee80faf2166a26f73f85c9a9a 100644 (file)
@@ -523,17 +523,13 @@ typedef struct {
  */
 static isc_result_t
 foreach_node_rr_action(void *data, dns_rdataset_t *rdataset) {
-       isc_result_t result;
        foreach_node_rr_ctx_t *ctx = data;
        DNS_RDATASET_FOREACH(rdataset) {
                rr_t rr = { 0, DNS_RDATA_INIT };
 
                dns_rdataset_current(rdataset, &rr.rdata);
                rr.ttl = rdataset->ttl;
-               result = (*ctx->rr_action)(ctx->rr_action_data, &rr);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR((*ctx->rr_action)(ctx->rr_action_data, &rr));
        }
        return ISC_R_SUCCESS;
 }
@@ -1537,14 +1533,10 @@ check_soa_increment(dns_db_t *db, dns_dbversion_t *ver,
                    dns_rdata_t *update_rdata, bool *ok) {
        uint32_t db_serial;
        uint32_t update_serial;
-       isc_result_t result;
 
        update_serial = dns_soa_getserial(update_rdata);
 
-       result = dns_db_getsoaserial(db, ver, &db_serial);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getsoaserial(db, ver, &db_serial));
 
        if (DNS_SERIAL_GE(db_serial, update_serial)) {
                *ok = false;
@@ -2170,10 +2162,7 @@ get_iterations(dns_db_t *db, dns_dbversion_t *ver, dns_rdatatype_t privatetype,
 
        dns_rdataset_init(&rdataset);
 
-       result = dns_db_getoriginnode(db, &node);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_getoriginnode(db, &node));
        result = dns_db_findrdataset(db, node, ver, dns_rdatatype_nsec3param, 0,
                                     (isc_stdtime_t)0, &rdataset, NULL);
        if (result == ISC_R_NOTFOUND) {
@@ -3430,12 +3419,9 @@ send_forward(ns_client_t *client, dns_zone_t *zone) {
        char classbuf[DNS_RDATACLASS_FORMATSIZE];
        update_t *uev = NULL;
 
-       result = checkupdateacl(client, dns_zone_getforwardacl(zone),
-                               "update forwarding", dns_zone_getorigin(zone),
-                               true, false);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(checkupdateacl(client, dns_zone_getforwardacl(zone),
+                             "update forwarding", dns_zone_getorigin(zone),
+                             true, false));
 
        result = isc_quota_acquire(&client->manager->sctx->updquota);
        if (result != ISC_R_SUCCESS) {
index 3ca1c1f7026a05a63bd161895e7948c60adb6e24..7b289cee2afd2af3fe4e266248f86a8b343e06ac 100644 (file)
@@ -330,11 +330,9 @@ cleanup:
 static isc_result_t
 axfr_rrstream_first(rrstream_t *rs) {
        axfr_rrstream_t *s = (axfr_rrstream_t *)rs;
-       isc_result_t result;
-       result = dns_rriterator_first(&s->it);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+
+       RETERR(dns_rriterator_first(&s->it));
+
        /* Skip SOA records. */
        for (;;) {
                dns_name_t *name_dummy = NULL;
@@ -345,12 +343,10 @@ axfr_rrstream_first(rrstream_t *rs) {
                if (rdata->type != dns_rdatatype_soa) {
                        break;
                }
-               result = dns_rriterator_next(&s->it);
-               if (result != ISC_R_SUCCESS) {
-                       break;
-               }
+               RETERR(dns_rriterator_next(&s->it));
        }
-       return result;
+
+       return ISC_R_SUCCESS;
 }
 
 static isc_result_t
index 663c9ff19cb028720c13c550f69179e6a583fa36..0165df27427c709e7a089f077f883d42363f7035 100644 (file)
@@ -258,10 +258,7 @@ make_dispatchset(dns_dispatchmgr_t *dispatchmgr, unsigned int ndisps,
        dns_dispatch_t *disp = NULL;
 
        isc_sockaddr_any(&any);
-       result = dns_dispatch_createudp(dispatchmgr, &any, &disp);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_dispatch_createudp(dispatchmgr, &any, &disp));
 
        result = dns_dispatchset_create(isc_g_mctx, disp, dsetp, ndisps);
        dns_dispatch_detach(&disp);
index e5fdd75fa5b6f5942fb329b11759d0aaaabb6599..1d822fed8db8405820bd1fde8df7833a641e8343 100644 (file)
@@ -88,7 +88,6 @@ rawdata_callback(dns_zone_t *zone, dns_masterrawheader_t *h) {
 static isc_result_t
 setup_master(void (*warn)(struct dns_rdatacallbacks *, const char *, ...),
             void (*error)(struct dns_rdatacallbacks *, const char *, ...)) {
-       isc_result_t result;
        int len;
        isc_buffer_t source;
 
@@ -100,10 +99,7 @@ setup_master(void (*warn)(struct dns_rdatacallbacks *, const char *, ...),
        isc_buffer_setactive(&source, len);
        dns_master_initrawheader(&header);
 
-       result = dns_name_fromtext(dns_origin, &source, dns_rootname, 0);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromtext(dns_origin, &source, dns_rootname, 0));
 
        dns_rdatacallbacks_init_stdio(&callbacks);
        callbacks.add = add_callback;
@@ -116,7 +112,7 @@ setup_master(void (*warn)(struct dns_rdatacallbacks *, const char *, ...),
                callbacks.error = error;
        }
        headerset = false;
-       return result;
+       return ISC_R_SUCCESS;
 }
 
 static isc_result_t
@@ -126,10 +122,7 @@ test_master(const char *workdir, const char *testfile,
            void (*error)(struct dns_rdatacallbacks *, const char *, ...)) {
        isc_result_t result;
 
-       result = setup_master(warn, error);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(setup_master(warn, error));
 
        dns_rdatacallbacks_init_stdio(&callbacks);
        callbacks.add = add_callback;
@@ -143,10 +136,7 @@ test_master(const char *workdir, const char *testfile,
        }
 
        if (workdir != NULL) {
-               result = isc_dir_chdir(workdir);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(isc_dir_chdir(workdir));
        }
 
        result = dns_master_loadfile(testfile, dns_origin, dns_origin,
index 18b8f55052a788d050e0175f3a1ec3e0dd9e3143..1abd26c5e30acd3bc9642d782be3d8394dde2ec9 100644 (file)
@@ -65,10 +65,7 @@ dns_test_makeview(const char *name, bool with_dispatchmgr, bool with_cache,
        dns_dispatchmgr_t *dispatchmgr = NULL;
 
        if (with_dispatchmgr) {
-               result = dns_dispatchmgr_create(isc_g_mctx, &dispatchmgr);
-               if (result != ISC_R_SUCCESS) {
-                       return result;
-               }
+               RETERR(dns_dispatchmgr_create(isc_g_mctx, &dispatchmgr));
        }
 
        dns_view_create(isc_g_mctx, dispatchmgr, dns_rdataclass_in, name,
@@ -211,16 +208,10 @@ dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
 
        name = dns_fixedname_initname(&fixed);
 
-       result = dns_name_fromstring(name, origin, dns_rootname, 0, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromstring(name, origin, dns_rootname, 0, NULL));
 
-       result = dns_db_create(isc_g_mctx, dbimp, name, dbtype,
-                              dns_rdataclass_in, 0, NULL, db);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_create(isc_g_mctx, dbimp, name, dbtype, dns_rdataclass_in,
+                            0, NULL, db));
 
        result = dns_db_load(*db, testfile, dns_masterformat_text, 0);
        return result;
@@ -263,7 +254,7 @@ dns_test_tohex(const unsigned char *data, size_t len, char *buf,
 isc_result_t
 dns_test_getdata(const char *file, unsigned char *buf, size_t bufsiz,
                 size_t *sizep) {
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        unsigned char *bp;
        char *rp, *wp;
        char s[BUFSIZ];
@@ -271,10 +262,7 @@ dns_test_getdata(const char *file, unsigned char *buf, size_t bufsiz,
        FILE *f = NULL;
        int n;
 
-       result = isc_stdio_open(file, "r", &f);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_stdio_open(file, "r", &f));
 
        bp = buf;
        while (fgets(s, sizeof(s), f) != NULL) {
index 359077e58a6c226c724082eb5ccb1c6e636a6cca..d91c849bf3b4aee3a1ba182eeb0d0819cfee2c19 100644 (file)
@@ -146,10 +146,7 @@ ns_test_serve_zone(const char *zonename, const char *filename,
        /*
         * Prepare zone structure for further processing.
         */
-       result = dns_test_makezone(zonename, &served_zone, view, false);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_test_makezone(zonename, &served_zone, view, false));
 
        /*
         * Start zone manager.
@@ -518,16 +515,10 @@ ns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
 
        name = dns_fixedname_initname(&fixed);
 
-       result = dns_name_fromstring(name, origin, dns_rootname, 0, NULL);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_name_fromstring(name, origin, dns_rootname, 0, NULL));
 
-       result = dns_db_create(isc_g_mctx, dbimp, name, dbtype,
-                              dns_rdataclass_in, 0, NULL, db);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(dns_db_create(isc_g_mctx, dbimp, name, dbtype, dns_rdataclass_in,
+                            0, NULL, db));
 
        result = dns_db_load(*db, testfile, dns_masterformat_text, 0);
        return result;
@@ -558,10 +549,7 @@ ns_test_getdata(const char *file, unsigned char *buf, size_t bufsiz,
        FILE *f = NULL;
        int n;
 
-       result = isc_stdio_open(file, "r", &f);
-       if (result != ISC_R_SUCCESS) {
-               return result;
-       }
+       RETERR(isc_stdio_open(file, "r", &f));
 
        bp = buf;
        while (fgets(s, sizeof(s), f) != NULL) {