From: Ondřej Surý Date: Mon, 26 Jun 2023 09:04:33 +0000 (+0200) Subject: Refactor dns_adb_create() to return void X-Git-Tag: v9.19.16~21^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=045d8d9ed60ce9bd3e265e638f790f4fd1b18da7;p=thirdparty%2Fbind9.git 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. --- diff --git a/lib/dns/adb.c b/lib/dns/adb.c index d339bcafd1a..7102226bd5f 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 6a1af891580..f7dee889e1d 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 e6b1bb28c93..d133c805aaf 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);