mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-15 22:09:31 -04:00
Refactor dns_zone_create() to return void
After isc_stats_create() change, the dns_zone_create() cannot fail, so refactor the function to return void and fix all its uses.
This commit is contained in:
parent
045d8d9ed6
commit
ea2fe8eea4
8 changed files with 15 additions and 39 deletions
|
|
@ -595,7 +595,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
|||
zonename, filename, classname);
|
||||
}
|
||||
|
||||
CHECK(dns_zone_create(&zone, mctx, 0));
|
||||
dns_zone_create(&zone, mctx, 0);
|
||||
|
||||
dns_zone_settype(zone, dns_zone_primary);
|
||||
|
||||
|
|
|
|||
|
|
@ -1938,7 +1938,7 @@ dns64_reverse(dns_view_t *view, isc_mem_t *mctx, isc_netaddr_t *na,
|
|||
isc_buffer_constinit(&b, reverse, strlen(reverse));
|
||||
isc_buffer_add(&b, strlen(reverse));
|
||||
CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
|
||||
CHECK(dns_zone_create(&zone, mctx, 0));
|
||||
dns_zone_create(&zone, mctx, 0);
|
||||
CHECK(dns_zone_setorigin(zone, name));
|
||||
dns_zone_setview(zone, view);
|
||||
CHECK(dns_zonemgr_managezone(named_g_server->zonemgr, zone));
|
||||
|
|
@ -3613,7 +3613,7 @@ create_ipv4only_zone(dns_zone_t *pzone, dns_view_t *view,
|
|||
/*
|
||||
* Create the actual zone.
|
||||
*/
|
||||
CHECK(dns_zone_create(&zone, mctx, 0));
|
||||
dns_zone_create(&zone, mctx, 0);
|
||||
CHECK(dns_zone_setorigin(zone, name));
|
||||
CHECK(dns_zonemgr_managezone(named_g_server->zonemgr, zone));
|
||||
dns_zone_setclass(zone, view->rdclass);
|
||||
|
|
@ -6793,8 +6793,8 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
|
|||
if (inline_signing) {
|
||||
dns_zone_getraw(zone, &raw);
|
||||
if (raw == NULL) {
|
||||
CHECK(dns_zone_create(&raw, dns_zone_getmem(zone),
|
||||
dns_zone_gettid(zone)));
|
||||
dns_zone_create(&raw, dns_zone_getmem(zone),
|
||||
dns_zone_gettid(zone));
|
||||
CHECK(dns_zone_setorigin(raw, origin));
|
||||
dns_zone_setview(raw, view);
|
||||
dns_zone_setstats(raw, named_g_server->zonestats);
|
||||
|
|
|
|||
|
|
@ -66,12 +66,8 @@ create_zone(sample_instance_t *const inst, dns_name_t *const name,
|
|||
|
||||
zone_argv[0] = inst->db_name;
|
||||
|
||||
result = dns_zone_create(&raw, inst->mctx, 0); /* FIXME */
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
log_write(ISC_LOG_ERROR, "create_zone: dns_zone_create -> %s\n",
|
||||
isc_result_totext(result));
|
||||
goto cleanup;
|
||||
}
|
||||
dns_zone_create(&raw, inst->mctx, 0); /* FIXME: all zones are assigned
|
||||
to loop 0 */
|
||||
result = dns_zone_setorigin(raw, name);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
log_write(ISC_LOG_ERROR,
|
||||
|
|
|
|||
|
|
@ -274,12 +274,7 @@ LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED) {
|
|||
return (1);
|
||||
}
|
||||
|
||||
result = dns_zone_create(&zone, mctx, 0);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "dns_zone_create failed: %s\n",
|
||||
isc_result_totext(result));
|
||||
return (1);
|
||||
}
|
||||
dns_zone_create(&zone, mctx, 0);
|
||||
|
||||
result = dns_zone_setorigin(zone, name);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
|
|
|
|||
|
|
@ -450,10 +450,7 @@ dns_dlz_writeablezone(dns_view_t *view, dns_dlzdb_t *dlzdb,
|
|||
INSIST(dupzone == NULL);
|
||||
|
||||
/* Create it */
|
||||
result = dns_zone_create(&zone, view->mctx, 0);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
dns_zone_create(&zone, view->mctx, 0);
|
||||
result = dns_zone_setorigin(zone, origin);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ ISC_LANG_BEGINDECLS
|
|||
*** Functions
|
||||
***/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx, unsigned int tid);
|
||||
/*%<
|
||||
* Creates a new empty zone and attach '*zonep' to it.
|
||||
|
|
@ -160,11 +160,6 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx, unsigned int tid);
|
|||
*
|
||||
* Ensures:
|
||||
*\li '*zonep' refers to a valid zone.
|
||||
*
|
||||
* Returns:
|
||||
*\li #ISC_R_SUCCESS
|
||||
*\li #ISC_R_NOMEMORY
|
||||
*\li #ISC_R_UNEXPECTED
|
||||
*/
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1080,7 +1080,7 @@ inc_stats(dns_zone_t *zone, isc_statscounter_t counter) {
|
|||
*** Public functions.
|
||||
***/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx, unsigned int tid) {
|
||||
isc_time_t now;
|
||||
dns_zone_t *zone = NULL;
|
||||
|
|
@ -1165,7 +1165,6 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx, unsigned int tid) {
|
|||
dns_zone_setdbtype(zone, dbargc_default, dbargv_default);
|
||||
|
||||
*zonep = zone;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -18242,7 +18241,6 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, isc_nm_t *netmgr,
|
|||
|
||||
isc_result_t
|
||||
dns_zonemgr_createzone(dns_zonemgr_t *zmgr, dns_zone_t **zonep) {
|
||||
isc_result_t result;
|
||||
isc_mem_t *mctx = NULL;
|
||||
dns_zone_t *zone = NULL;
|
||||
unsigned int tid;
|
||||
|
|
@ -18261,13 +18259,11 @@ dns_zonemgr_createzone(dns_zonemgr_t *zmgr, dns_zone_t **zonep) {
|
|||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
result = dns_zone_create(&zone, mctx, tid);
|
||||
dns_zone_create(&zone, mctx, tid);
|
||||
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
*zonep = zone;
|
||||
}
|
||||
*zonep = zone;
|
||||
|
||||
return (result);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
|
|
|||
|
|
@ -104,10 +104,7 @@ dns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view,
|
|||
/*
|
||||
* Create the zone structure.
|
||||
*/
|
||||
result = dns_zone_create(&zone, mctx, 0);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
dns_zone_create(&zone, mctx, 0);
|
||||
|
||||
/*
|
||||
* Set zone type and origin.
|
||||
|
|
|
|||
Loading…
Reference in a new issue