From 045d8d9ed60ce9bd3e265e638f790f4fd1b18da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Mon, 26 Jun 2023 11:04:33 +0200 Subject: [PATCH] Refactor dns_adb_create() to return void After isc_stats_create() change, the dns_adb_create() cannot fail, so refactor the function to return void and fix all its uses. --- lib/dns/adb.c | 3 +-- lib/dns/include/dns/adb.h | 7 +------ lib/dns/view.c | 6 +----- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/dns/adb.c b/lib/dns/adb.c index d339bcafd1..7102226bd5 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -1960,7 +1960,7 @@ ISC_REFCOUNT_IMPL(dns_adb, destroy); * Public functions. */ -isc_result_t +void dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_loopmgr_t *loopmgr, dns_adb_t **newadb) { dns_adb_t *adb = NULL; @@ -2012,7 +2012,6 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_loopmgr_t *loopmgr, */ adb->magic = DNS_ADB_MAGIC; *newadb = adb; - return (ISC_R_SUCCESS); } void diff --git a/lib/dns/include/dns/adb.h b/lib/dns/include/dns/adb.h index 6a1af89158..f7dee889e1 100644 --- a/lib/dns/include/dns/adb.h +++ b/lib/dns/include/dns/adb.h @@ -250,7 +250,7 @@ struct dns_adbaddrinfo { **** FUNCTIONS ****/ -isc_result_t +void dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_loopmgr_t *loopmgr, dns_adb_t **newadb); /*%< @@ -270,11 +270,6 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_loopmgr_t *loopmgr, *\li 'loopmgr' be a valid loop manager. * *\li 'newadb' != NULL && '*newadb' == NULL. - * - * Returns: - * - *\li #ISC_R_SUCCESS after happiness. - *\li #ISC_R_NOMEMORY after resource allocation failure. */ #if DNS_ADB_TRACE diff --git a/lib/dns/view.c b/lib/dns/view.c index e6b1bb28c9..d133c805aa 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -619,11 +619,8 @@ dns_view_createresolver(dns_view_t *view, isc_loopmgr_t *loopmgr, isc_mem_create(&mctx); isc_mem_setname(mctx, "ADB"); - result = dns_adb_create(mctx, view, loopmgr, &view->adb); + dns_adb_create(mctx, view, loopmgr, &view->adb); isc_mem_detach(&mctx); - if (result != ISC_R_SUCCESS) { - goto cleanup_resolver; - } result = dns_requestmgr_create(view->mctx, view->dispatchmgr, dispatchv4, dispatchv6, @@ -638,7 +635,6 @@ cleanup_adb: dns_adb_shutdown(view->adb); dns_adb_detach(&view->adb); -cleanup_resolver: dns_resolver_shutdown(view->resolver); dns_resolver_detach(&view->resolver);