]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
dns/ssu.c: Return void when ISC_R_SUCCESS is only returned value
authorOndřej Surý <ondrej@sury.org>
Wed, 6 Oct 2021 11:18:16 +0000 (13:18 +0200)
committerOndřej Surý <ondrej@sury.org>
Wed, 13 Oct 2021 03:47:48 +0000 (05:47 +0200)
With isc_mem_get() and dns_name_dup() no longer being able to fail, some
functions can now only return ISC_R_SUCCESS.  Change the return type to
void for the following function(s):

 * dns_ssutable_addrule()
 * dns_ssutable_create()
 * dns_ssutable_createdlz()

bin/named/zoneconf.c
lib/dns/dlz.c
lib/dns/include/dns/ssu.h
lib/dns/ssu.c

index a7b83fc7228fea145ebfaf5cc47eaa82bf8fc35c..c6b832cc34a70ac7319444f6179d2c3a34ee4804 100644 (file)
@@ -202,7 +202,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
        dns_ssutable_t *table = NULL;
        isc_mem_t *mctx = dns_zone_getmctx(zone);
        bool autoddns = false;
-       isc_result_t result;
+       isc_result_t result = ISC_R_SUCCESS;
 
        (void)cfg_map_get(zconfig, "update-policy", &updatepolicy);
 
@@ -218,10 +218,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
                updatepolicy = NULL;
        }
 
-       result = dns_ssutable_create(mctx, &table);
-       if (result != ISC_R_SUCCESS) {
-               return (result);
-       }
+       dns_ssutable_create(mctx, &table);
 
        for (element = cfg_list_first(updatepolicy); element != NULL;
             element = cfg_list_next(element))
@@ -342,15 +339,12 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
                }
                INSIST(i == n);
 
-               result = dns_ssutable_addrule(
-                       table, grant, dns_fixedname_name(&fident), mtype,
-                       dns_fixedname_name(&fname), n, types);
+               dns_ssutable_addrule(table, grant, dns_fixedname_name(&fident),
+                                    mtype, dns_fixedname_name(&fname), n,
+                                    types);
                if (types != NULL) {
                        isc_mem_put(mctx, types, n * sizeof(*types));
                }
-               if (result != ISC_R_SUCCESS) {
-                       goto cleanup;
-               }
        }
 
        /*
@@ -371,17 +365,12 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
                        goto cleanup;
                }
 
-               result = dns_ssutable_addrule(
-                       table, true, named_g_server->session_keyname,
-                       dns_ssumatchtype_local, dns_zone_getorigin(zone), 1,
-                       &any);
-
-               if (result != ISC_R_SUCCESS) {
-                       goto cleanup;
-               }
+               dns_ssutable_addrule(table, true,
+                                    named_g_server->session_keyname,
+                                    dns_ssumatchtype_local,
+                                    dns_zone_getorigin(zone), 1, &any);
        }
 
-       result = ISC_R_SUCCESS;
        dns_zone_setssutable(zone, table);
 
 cleanup:
index 6242d91ca1e519b6cb33fd00e1c6859d17837e24..f4d1ce7f03e9d36b4468ef247d7fe5c13f38864d 100644 (file)
@@ -464,11 +464,7 @@ dns_dlz_writeablezone(dns_view_t *view, dns_dlzdb_t *dlzdb,
        dns_zone_setadded(zone, true);
 
        if (dlzdb->ssutable == NULL) {
-               result = dns_ssutable_createdlz(dlzdb->mctx, &dlzdb->ssutable,
-                                               dlzdb);
-               if (result != ISC_R_SUCCESS) {
-                       goto cleanup;
-               }
+               dns_ssutable_createdlz(dlzdb->mctx, &dlzdb->ssutable, dlzdb);
        }
        dns_zone_setssutable(zone, dlzdb->ssutable);
 
index 18e2ce19e6e18ddacccaa5f9184119bd6268b0bc..4b6ead69f57c721f76243ea014f272884f6d796e 100644 (file)
@@ -52,7 +52,7 @@ typedef struct dns_ssuruletype {
        unsigned int    max;  /* maximum number of records allowed. */
 } dns_ssuruletype_t;
 
-isc_result_t
+void
 dns_ssutable_create(isc_mem_t *mctx, dns_ssutable_t **table);
 /*%<
  *     Creates a table that will be used to store simple-secure-update rules.
@@ -67,7 +67,7 @@ dns_ssutable_create(isc_mem_t *mctx, dns_ssutable_t **table);
  *\li          ISC_R_NOMEMORY
  */
 
-isc_result_t
+void
 dns_ssutable_createdlz(isc_mem_t *mctx, dns_ssutable_t **tablep,
                       dns_dlzdb_t *dlzdatabase);
 /*%<
@@ -104,7 +104,7 @@ dns_ssutable_detach(dns_ssutable_t **tablep);
  *                     resources used by the table will be freed.
  */
 
-isc_result_t
+void
 dns_ssutable_addrule(dns_ssutable_t *table, bool grant,
                     const dns_name_t *identity, dns_ssumatchtype_t matchtype,
                     const dns_name_t *name, unsigned int ntypes,
index e3b674780d91381e5f0b3b16f00d2b62f9371108..68558be0a9bcaa1c6fee7e611b46b99d78dcc65b 100644 (file)
@@ -57,7 +57,7 @@ struct dns_ssutable {
        ISC_LIST(dns_ssurule_t) rules;
 };
 
-isc_result_t
+void
 dns_ssutable_create(isc_mem_t *mctx, dns_ssutable_t **tablep) {
        dns_ssutable_t *table;
 
@@ -71,7 +71,6 @@ dns_ssutable_create(isc_mem_t *mctx, dns_ssutable_t **tablep) {
        ISC_LIST_INIT(table->rules);
        table->magic = SSUTABLEMAGIC;
        *tablep = table;
-       return (ISC_R_SUCCESS);
 }
 
 static inline void
@@ -129,7 +128,7 @@ dns_ssutable_detach(dns_ssutable_t **tablep) {
        }
 }
 
-isc_result_t
+void
 dns_ssutable_addrule(dns_ssutable_t *table, bool grant,
                     const dns_name_t *identity, dns_ssumatchtype_t matchtype,
                     const dns_name_t *name, unsigned int ntypes,
@@ -177,8 +176,6 @@ dns_ssutable_addrule(dns_ssutable_t *table, bool grant,
 
        rule->magic = SSURULEMAGIC;
        ISC_LIST_INITANDAPPEND(table->rules, rule, link);
-
-       return (ISC_R_SUCCESS);
 }
 
 static inline bool
@@ -599,19 +596,15 @@ dns_ssutable_nextrule(dns_ssurule_t *rule, dns_ssurule_t **nextrule) {
 /*
  * Create a specialised SSU table that points at an external DLZ database
  */
-isc_result_t
+void
 dns_ssutable_createdlz(isc_mem_t *mctx, dns_ssutable_t **tablep,
                       dns_dlzdb_t *dlzdatabase) {
-       isc_result_t result;
        dns_ssurule_t *rule;
        dns_ssutable_t *table = NULL;
 
        REQUIRE(tablep != NULL && *tablep == NULL);
 
-       result = dns_ssutable_create(mctx, &table);
-       if (result != ISC_R_SUCCESS) {
-               return (result);
-       }
+       dns_ssutable_create(mctx, &table);
 
        table->dlzdatabase = dlzdatabase;
 
@@ -627,7 +620,6 @@ dns_ssutable_createdlz(isc_mem_t *mctx, dns_ssutable_t **tablep,
 
        ISC_LIST_INITANDAPPEND(table->rules, rule, link);
        *tablep = table;
-       return (ISC_R_SUCCESS);
 }
 
 isc_result_t