From f51a9d834ce0fcddd2daf689ca52b747f74dea0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 6 Oct 2021 13:40:32 +0200 Subject: [PATCH] dns/view.c: Return void when ISC_R_SUCCESS is only returned value 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 | 12 ++++++------ lib/dns/include/dns/view.h | 4 ++-- lib/dns/view.c | 10 ++++------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/bin/named/server.c b/bin/named/server.c index 113a838be7..ab853b0b73 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -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); } } diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index b053080e76..cd8cd0b006 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -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. diff --git a/lib/dns/view.c b/lib/dns/view.c index fad58e57d6..de5464f288 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -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