]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
dns/view.c: Return void when ISC_R_SUCCESS is only returned value
authorOndřej Surý <ondrej@sury.org>
Wed, 6 Oct 2021 11:40:32 +0000 (13:40 +0200)
committerOndřej Surý <ondrej@sury.org>
Wed, 13 Oct 2021 03:47:48 +0000 (05:47 +0200)
With isc_mem_get() and dns_name_dup() no longer being able to fail, some
functions can now only return ISC_R_SUCCESS.  Change the return type to
void for the following function(s):

 * dns_view_adddelegationonly()
 * dns_view_excludedelegationonly()

bin/named/server.c
lib/dns/include/dns/view.h
lib/dns/view.c

index 113a838be7ce96b2457bb9bbaec4aab91a37e054..ab853b0b7309d77fff8e306188c0ff73db2bc964 100644 (file)
@@ -5591,7 +5591,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
                        exclude = cfg_listelt_value(element);
                        CHECK(dns_name_fromstring(
                                name, cfg_obj_asstring(exclude), 0, NULL));
-                       CHECK(dns_view_excludedelegationonly(view, name));
+                       dns_view_excludedelegationonly(view, name);
                }
        } else {
                dns_view_setrootdelonly(view, false);
@@ -6337,7 +6337,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
        const cfg_obj_t *ixfrfromdiffs = NULL;
        const cfg_obj_t *only = NULL;
        const cfg_obj_t *viewobj = NULL;
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
        isc_result_t tresult;
        isc_buffer_t buffer;
        dns_fixedname_t fixorigin;
@@ -6472,7 +6472,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
                                              &only);
                        if (tresult == ISC_R_SUCCESS && cfg_obj_asboolean(only))
                        {
-                               CHECK(dns_view_adddelegationonly(view, origin));
+                               dns_view_adddelegationonly(view, origin);
                        }
                } else {
                        isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@@ -6504,7 +6504,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
                only = NULL;
                tresult = cfg_map_get(zoptions, "delegation-only", &only);
                if (tresult == ISC_R_SUCCESS && cfg_obj_asboolean(only)) {
-                       CHECK(dns_view_adddelegationonly(view, origin));
+                       dns_view_adddelegationonly(view, origin);
                }
                goto cleanup;
        }
@@ -6513,7 +6513,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
         * "delegation-only zones" aren't zones either.
         */
        if (strcasecmp(ztypestr, "delegation-only") == 0) {
-               result = dns_view_adddelegationonly(view, origin);
+               dns_view_adddelegationonly(view, origin);
                goto cleanup;
        }
 
@@ -6679,7 +6679,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
        only = NULL;
        if (cfg_map_get(zoptions, "delegation-only", &only) == ISC_R_SUCCESS) {
                if (cfg_obj_asboolean(only)) {
-                       CHECK(dns_view_adddelegationonly(view, origin));
+                       dns_view_adddelegationonly(view, origin);
                }
        }
 
index b053080e766e82be53f9af5a9e9d1e9a7dfc8f45..cd8cd0b006bafd441d9d73bc1ae18ccb41360966 100644 (file)
@@ -952,7 +952,7 @@ dns_view_flushname(dns_view_t *view, const dns_name_t *name);
  *     other returns are failures.
  */
 
-isc_result_t
+void
 dns_view_adddelegationonly(dns_view_t *view, const dns_name_t *name);
 /*%<
  * Add the given name to the delegation only table.
@@ -966,7 +966,7 @@ dns_view_adddelegationonly(dns_view_t *view, const dns_name_t *name);
  *\li  #ISC_R_NOMEMORY
  */
 
-isc_result_t
+void
 dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name);
 /*%<
  * Add the given name to be excluded from the root-delegation-only.
index fad58e57d63a89b3274b7dc60556bdd4a3222d40..de5464f288c1cf23757cc3b6eb77e97202deadab 100644 (file)
@@ -1739,7 +1739,7 @@ dns_view_flushnode(dns_view_t *view, const dns_name_t *name, bool tree) {
        return (result);
 }
 
-isc_result_t
+void
 dns_view_adddelegationonly(dns_view_t *view, const dns_name_t *name) {
        dns_name_t *item;
        unsigned int hash;
@@ -1760,16 +1760,15 @@ dns_view_adddelegationonly(dns_view_t *view, const dns_name_t *name) {
                item = ISC_LIST_NEXT(item, link);
        }
        if (item != NULL) {
-               return (ISC_R_SUCCESS);
+               return;
        }
        item = isc_mem_get(view->mctx, sizeof(*item));
        dns_name_init(item, NULL);
        dns_name_dup(name, view->mctx, item);
        ISC_LIST_APPEND(view->delonly[hash], item, link);
-       return (ISC_R_SUCCESS);
 }
 
-isc_result_t
+void
 dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name) {
        dns_name_t *item;
        unsigned int hash;
@@ -1790,13 +1789,12 @@ dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name) {
                item = ISC_LIST_NEXT(item, link);
        }
        if (item != NULL) {
-               return (ISC_R_SUCCESS);
+               return;
        }
        item = isc_mem_get(view->mctx, sizeof(*item));
        dns_name_init(item, NULL);
        dns_name_dup(name, view->mctx, item);
        ISC_LIST_APPEND(view->rootexclude[hash], item, link);
-       return (ISC_R_SUCCESS);
 }
 
 bool