]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
dns_name_dupwithoffsets() cannot fail
authorEvan Hunt <each@isc.org>
Tue, 12 Mar 2024 21:38:18 +0000 (14:38 -0700)
committerEvan Hunt <each@isc.org>
Thu, 11 Apr 2024 02:51:07 +0000 (22:51 -0400)
this function now always returns success; change it to void and
clean up its callers.

bin/tests/system/dyndb/driver/db.c
lib/dns/include/dns/name.h
lib/dns/name.c
lib/dns/qpcache.c
lib/dns/rbtdb.c
lib/dns/sdlz.c

index 90ddac13d130c6cc85d2bad07a272e1cdd129e76..521327d1254423302f89cc95ef3694eb5c9bef87 100644 (file)
@@ -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);
        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);
 
index 7a3ae95477688e099cfec0bcaaaae42a63f209c9..a9a15ae5dea9c3eee13ddd5d1b71641800395a24 100644 (file)
@@ -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.
  */
 
-isc_result_t
+void
 dns_name_dupwithoffsets(const dns_name_t *source, isc_mem_t *mctx,
                        dns_name_t *target);
 /*%<
index 6149a114459e6cb844c347710d0de17df9d1f1f2..ce3b78be9bd2f9ba32cb848eb5ca1a9d4c78f015 100644 (file)
@@ -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_t *target) {
        /*
@@ -1819,8 +1819,6 @@ dns_name_dupwithoffsets(const dns_name_t *source, isc_mem_t *mctx,
        } else {
                set_offsets(target, target->offsets, NULL);
        }
-
-       return (ISC_R_SUCCESS);
 }
 
 void
@@ -1999,7 +1997,7 @@ dns_name_fromstring(dns_name_t *target, const char *src,
        }
 
        if (name != target) {
-               result = dns_name_dupwithoffsets(name, mctx, target);
+               dns_name_dupwithoffsets(name, mctx, target);
        }
        return (result);
 }
index 36b55d80a677988d2875e6694b89a17c63c4d590..0810e1906935d5e40a55cc0b4d07f1378a8fb4be 100644 (file)
@@ -3856,7 +3856,6 @@ dns__qpcache_create(isc_mem_t *mctx, const dns_name_t *origin,
                    unsigned int argc, char *argv[],
                    void *driverarg ISC_ATTR_UNUSED, dns_db_t **dbp) {
        dns_qpdb_t *qpdb = NULL;
-       isc_result_t result;
        isc_mem_t *hmctx = mctx;
        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.
         */
-       result = dns_name_dupwithoffsets(origin, mctx, &qpdb->common.origin);
-       if (result != ISC_R_SUCCESS) {
-               free_qpdb(qpdb, false);
-               return (result);
-       }
+       dns_name_dupwithoffsets(origin, mctx, &qpdb->common.origin);
 
        /*
         * Make the qp tries.
index 92fb702575c374250aec6a153a13c5b4fb767aee..0dee744b7a4fc8186d6408f93af2c8c2e1f7eebd 100644 (file)
@@ -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.
         */
-       result = dns_name_dupwithoffsets(origin, mctx, &rbtdb->common.origin);
-       if (result != ISC_R_SUCCESS) {
-               free_rbtdb(rbtdb, false);
-               return (result);
-       }
+       dns_name_dupwithoffsets(origin, mctx, &rbtdb->common.origin);
 
        /*
         * Make the Red-Black Trees.
index 6905e2185e3c9e92c3342272c402586a11e2e17e..b42b0a0dfd115dd4072bd57d45cee93a951fc55e 100644 (file)
@@ -1357,7 +1357,6 @@ static isc_result_t
 dns_sdlzcreateDBP(isc_mem_t *mctx, void *driverarg, void *dbdata,
                  const dns_name_t *name, dns_rdataclass_t rdclass,
                  dns_db_t **dbp) {
-       isc_result_t result;
        dns_sdlz_db_t *sdlzdb;
        dns_sdlzimplementation_t *imp;
 
@@ -1379,10 +1378,7 @@ dns_sdlzcreateDBP(isc_mem_t *mctx, void *driverarg, void *dbdata,
 
        /* initialize and set origin */
        dns_name_init(&sdlzdb->common.origin, NULL);
-       result = dns_name_dupwithoffsets(name, mctx, &sdlzdb->common.origin);
-       if (result != ISC_R_SUCCESS) {
-               goto mem_cleanup;
-       }
+       dns_name_dupwithoffsets(name, mctx, &sdlzdb->common.origin);
 
        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;
        *dbp = (dns_db_t *)sdlzdb;
 
-       return (result);
-mem_cleanup:
-       isc_mem_put(mctx, sdlzdb, sizeof(*sdlzdb));
-       return (result);
+       return (ISC_R_SUCCESS);
 }
 
 static isc_result_t