mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
dns_name_dupwithoffsets() cannot fail
this function now always returns success; change it to void and clean up its callers.
This commit is contained in:
@@ -614,7 +614,7 @@ create_db(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
isc_mem_attach(mctx, &sampledb->common.mctx);
|
isc_mem_attach(mctx, &sampledb->common.mctx);
|
||||||
dns_name_init(&sampledb->common.origin, NULL);
|
dns_name_init(&sampledb->common.origin, NULL);
|
||||||
|
|
||||||
CHECK(dns_name_dupwithoffsets(origin, mctx, &sampledb->common.origin));
|
dns_name_dupwithoffsets(origin, mctx, &sampledb->common.origin);
|
||||||
|
|
||||||
isc_refcount_init(&sampledb->common.references, 1);
|
isc_refcount_init(&sampledb->common.references, 1);
|
||||||
|
|
||||||
|
@@ -1078,7 +1078,7 @@ dns_name_dup(const dns_name_t *source, isc_mem_t *mctx, dns_name_t *target);
|
|||||||
*\li 'mctx' is a valid memory context.
|
*\li 'mctx' is a valid memory context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
isc_result_t
|
void
|
||||||
dns_name_dupwithoffsets(const dns_name_t *source, isc_mem_t *mctx,
|
dns_name_dupwithoffsets(const dns_name_t *source, isc_mem_t *mctx,
|
||||||
dns_name_t *target);
|
dns_name_t *target);
|
||||||
/*%<
|
/*%<
|
||||||
|
@@ -1784,7 +1784,7 @@ dns_name_dup(const dns_name_t *source, isc_mem_t *mctx, dns_name_t *target) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
void
|
||||||
dns_name_dupwithoffsets(const dns_name_t *source, isc_mem_t *mctx,
|
dns_name_dupwithoffsets(const dns_name_t *source, isc_mem_t *mctx,
|
||||||
dns_name_t *target) {
|
dns_name_t *target) {
|
||||||
/*
|
/*
|
||||||
@@ -1819,8 +1819,6 @@ dns_name_dupwithoffsets(const dns_name_t *source, isc_mem_t *mctx,
|
|||||||
} else {
|
} else {
|
||||||
set_offsets(target, target->offsets, NULL);
|
set_offsets(target, target->offsets, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1999,7 +1997,7 @@ dns_name_fromstring(dns_name_t *target, const char *src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (name != target) {
|
if (name != target) {
|
||||||
result = dns_name_dupwithoffsets(name, mctx, target);
|
dns_name_dupwithoffsets(name, mctx, target);
|
||||||
}
|
}
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
@@ -3856,7 +3856,6 @@ dns__qpcache_create(isc_mem_t *mctx, const dns_name_t *origin,
|
|||||||
unsigned int argc, char *argv[],
|
unsigned int argc, char *argv[],
|
||||||
void *driverarg ISC_ATTR_UNUSED, dns_db_t **dbp) {
|
void *driverarg ISC_ATTR_UNUSED, dns_db_t **dbp) {
|
||||||
dns_qpdb_t *qpdb = NULL;
|
dns_qpdb_t *qpdb = NULL;
|
||||||
isc_result_t result;
|
|
||||||
isc_mem_t *hmctx = mctx;
|
isc_mem_t *hmctx = mctx;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -3951,11 +3950,7 @@ dns__qpcache_create(isc_mem_t *mctx, const dns_name_t *origin,
|
|||||||
/*
|
/*
|
||||||
* Make a copy of the origin name.
|
* Make a copy of the origin name.
|
||||||
*/
|
*/
|
||||||
result = dns_name_dupwithoffsets(origin, mctx, &qpdb->common.origin);
|
dns_name_dupwithoffsets(origin, mctx, &qpdb->common.origin);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
free_qpdb(qpdb, false);
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make the qp tries.
|
* Make the qp tries.
|
||||||
|
@@ -3958,11 +3958,7 @@ dns__rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
/*
|
/*
|
||||||
* Make a copy of the origin name.
|
* Make a copy of the origin name.
|
||||||
*/
|
*/
|
||||||
result = dns_name_dupwithoffsets(origin, mctx, &rbtdb->common.origin);
|
dns_name_dupwithoffsets(origin, mctx, &rbtdb->common.origin);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
free_rbtdb(rbtdb, false);
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make the Red-Black Trees.
|
* Make the Red-Black Trees.
|
||||||
|
@@ -1357,7 +1357,6 @@ static isc_result_t
|
|||||||
dns_sdlzcreateDBP(isc_mem_t *mctx, void *driverarg, void *dbdata,
|
dns_sdlzcreateDBP(isc_mem_t *mctx, void *driverarg, void *dbdata,
|
||||||
const dns_name_t *name, dns_rdataclass_t rdclass,
|
const dns_name_t *name, dns_rdataclass_t rdclass,
|
||||||
dns_db_t **dbp) {
|
dns_db_t **dbp) {
|
||||||
isc_result_t result;
|
|
||||||
dns_sdlz_db_t *sdlzdb;
|
dns_sdlz_db_t *sdlzdb;
|
||||||
dns_sdlzimplementation_t *imp;
|
dns_sdlzimplementation_t *imp;
|
||||||
|
|
||||||
@@ -1379,10 +1378,7 @@ dns_sdlzcreateDBP(isc_mem_t *mctx, void *driverarg, void *dbdata,
|
|||||||
|
|
||||||
/* initialize and set origin */
|
/* initialize and set origin */
|
||||||
dns_name_init(&sdlzdb->common.origin, NULL);
|
dns_name_init(&sdlzdb->common.origin, NULL);
|
||||||
result = dns_name_dupwithoffsets(name, mctx, &sdlzdb->common.origin);
|
dns_name_dupwithoffsets(name, mctx, &sdlzdb->common.origin);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto mem_cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_refcount_init(&sdlzdb->common.references, 1);
|
isc_refcount_init(&sdlzdb->common.references, 1);
|
||||||
|
|
||||||
@@ -1394,10 +1390,7 @@ dns_sdlzcreateDBP(isc_mem_t *mctx, void *driverarg, void *dbdata,
|
|||||||
sdlzdb->common.impmagic = SDLZDB_MAGIC;
|
sdlzdb->common.impmagic = SDLZDB_MAGIC;
|
||||||
*dbp = (dns_db_t *)sdlzdb;
|
*dbp = (dns_db_t *)sdlzdb;
|
||||||
|
|
||||||
return (result);
|
return (ISC_R_SUCCESS);
|
||||||
mem_cleanup:
|
|
||||||
isc_mem_put(mctx, sdlzdb, sizeof(*sdlzdb));
|
|
||||||
return (result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
|
Reference in New Issue
Block a user