]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Apply the changes from updated set_if_not_null semantic patch
authorOndřej Surý <ondrej@isc.org>
Wed, 8 Oct 2025 15:34:12 +0000 (17:34 +0200)
committerOndřej Surý <ondrej@isc.org>
Wed, 8 Oct 2025 15:44:50 +0000 (17:44 +0200)
15 files changed:
bin/dnssec/dnssec-signzone.c
bin/dnssec/dnssectool.c
lib/dns/badcache.c
lib/dns/keymgr.c
lib/dns/message.c
lib/dns/nsec3.c
lib/dns/private.c
lib/dns/qpzone.c
lib/dns/resolver.c
lib/dns/update.c
lib/dns/zoneverify.c
lib/isc/netmgr/tlsstream.c
lib/isccc/alist.c
lib/isccc/cc.c
lib/isccfg/aclconf.c

index 496cfbfeeee6fba2bb20eed75bc40acc5dafdad2..61bb17be4e16999935155a85ad1997756d10ce6c 100644 (file)
@@ -1129,9 +1129,7 @@ is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin,
        result = dns_db_findrdataset(db, node, ver, dns_rdatatype_ns, 0, 0,
                                     &nsset, NULL);
        if (dns_rdataset_isassociated(&nsset)) {
-               if (ttlp != NULL) {
-                       *ttlp = nsset.ttl;
-               }
+               SET_IF_NOT_NULL(ttlp, nsset.ttl);
                dns_rdataset_disassociate(&nsset);
        }
 
index 5a1693fe6afc01839ee17b068f615ac40524281c..a0eb9f87025562ee43537dcca04ff7c5241428df 100644 (file)
@@ -511,9 +511,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
                                                id, oldid);
                                }
                        } else {
-                               if (exact != NULL) {
-                                       *exact = true;
-                               }
+                               SET_IF_NOT_NULL(exact, true);
                                if (verbose > 1) {
                                        fprintf(stderr, "Key ID %d exists\n",
                                                id);
index 8ba10d6e6e1f0543b8b705cd2a1e60d3b97f000d..06de7aa4dc829659e469f4f8343b7c4bf67fae52 100644 (file)
@@ -313,9 +313,7 @@ dns_badcache_find(dns_badcache_t *bc, const dns_name_t *name,
 
        if (found != NULL && bcentry_alive(ht, found, now)) {
                result = ISC_R_SUCCESS;
-               if (flagp != NULL) {
-                       *flagp = found->flags;
-               }
+               SET_IF_NOT_NULL(flagp, found->flags);
        }
 
        isc_tid_t tid = isc_tid();
index 81f689fe712b8b2c11e30b3f1fb680af434545bf..63177b68d5557289780531deaf8714404982c47b 100644 (file)
@@ -688,9 +688,7 @@ keymgr_dep(dst_key_t *k, dns_dnsseckeylist_t *keyring, uint32_t *dep) {
                                continue;
                        }
 
-                       if (dep != NULL) {
-                               *dep = dst_key_id(d->key);
-                       }
+                       SET_IF_NOT_NULL(dep, dst_key_id(d->key));
                        return true;
                }
        }
index e773a419d47b1274b1837beb56af72f83d12e20e..e777ed99dfe7eaa9a54dcd459781f86132b13a06 100644 (file)
@@ -759,9 +759,7 @@ findname(dns_name_t **foundname, const dns_name_t *target,
         dns_namelist_t *section) {
        ISC_LIST_FOREACH_REV(*section, name, link) {
                if (dns_name_equal(name, target)) {
-                       if (foundname != NULL) {
-                               *foundname = name;
-                       }
+                       SET_IF_NOT_NULL(foundname, name);
                        return ISC_R_SUCCESS;
                }
        }
index 64ddbc3614c80062ba6ed4cf40c42b9e0bc99272..48a3aede03d95b69a98bb64017a74590e8c3f221 100644 (file)
@@ -1894,9 +1894,7 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name,
         * the deepest covering zone.
         */
        if (!dns_nsec3_supportedhash(nsec3.hash)) {
-               if (unknown != NULL) {
-                       *unknown = true;
-               }
+               SET_IF_NOT_NULL(unknown, true);
                return ISC_R_IGNORE;
        }
 
index ca2d74d7ab0e86ca0284173852533870ac499028..41b854f3d845217af7e2327531900b6a77d9c424 100644 (file)
@@ -170,9 +170,7 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver,
                        if (REMOVE(rdata.data[1])) {
                                continue;
                        }
-                       if (build_nsec3 != NULL) {
-                               *build_nsec3 = true;
-                       }
+                       SET_IF_NOT_NULL(build_nsec3, true);
                        break;
                }
                goto success;
@@ -233,9 +231,7 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver,
                 * The last NSEC3 chain is being removed and does not have
                 * have NONSEC set.
                 */
-               if (build_nsec != NULL) {
-                       *build_nsec = true;
-               }
+               SET_IF_NOT_NULL(build_nsec, true);
                goto success;
        }
 
@@ -274,13 +270,9 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver,
 
        if (signing) {
                if (nsec3chain) {
-                       if (build_nsec3 != NULL) {
-                               *build_nsec3 = true;
-                       }
+                       SET_IF_NOT_NULL(build_nsec3, true);
                } else {
-                       if (build_nsec != NULL) {
-                               *build_nsec = true;
-                       }
+                       SET_IF_NOT_NULL(build_nsec, true);
                }
        }
 
index f6d0e30ee192d567e80d2f84c6eb0adfce812ed4..834af41b9733c10ef3aa3422f6bf70b8cc0ede21 100644 (file)
@@ -2282,22 +2282,14 @@ getnsec3parameters(dns_db_t *db, dns_dbversion_t *dbversion, dns_hash_t *hash,
        }
 
        if (version->havensec3) {
-               if (hash != NULL) {
-                       *hash = version->hash;
-               }
+               SET_IF_NOT_NULL(hash, version->hash);
                if (salt != NULL && salt_length != NULL) {
                        REQUIRE(*salt_length >= version->salt_length);
                        memmove(salt, version->salt, version->salt_length);
                }
-               if (salt_length != NULL) {
-                       *salt_length = version->salt_length;
-               }
-               if (iterations != NULL) {
-                       *iterations = version->iterations;
-               }
-               if (flags != NULL) {
-                       *flags = version->flags;
-               }
+               SET_IF_NOT_NULL(salt_length, version->salt_length);
+               SET_IF_NOT_NULL(iterations, version->iterations);
+               SET_IF_NOT_NULL(flags, version->flags);
                result = ISC_R_SUCCESS;
        }
        RWUNLOCK(&qpdb->lock, isc_rwlocktype_read);
index 61ec6191f6689ee028e8084cdbe49d937d7d07b9..09b0db084feae997361fb116b253405b7e1a7b24 100644 (file)
@@ -3374,9 +3374,7 @@ findname(fetchctx_t *fctx, const dns_name_t *name, in_port_t port,
         * No addresses and no pending events: the find failed.
         */
        if ((find->options & DNS_ADBFIND_OVERQUOTA) != 0) {
-               if (overquota != NULL) {
-                       *overquota = true;
-               }
+               SET_IF_NOT_NULL(overquota, true);
                fctx->quotacount++; /* quota exceeded */
        } else {
                fctx->adberr++; /* unreachable server, etc. */
index c5a749e503652a6804fc512bee158ee5440c04bc..f228a96ceac6e85e5eabe5efd351045fdcb89606 100644 (file)
@@ -1564,9 +1564,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db,
                CHECK(dns_diff_sort(diff, temp_order));
                state->state = sign_updates;
                state->magic = STATE_MAGIC;
-               if (statep != NULL) {
-                       *statep = state;
-               }
+               SET_IF_NOT_NULL(statep, state);
        } else {
                REQUIRE(DNS_STATE_VALID(*statep));
                state = *statep;
index cf5c65e84f1b6799c2bbcbe0fb39fded71f20dde..2451c2bcdf50e7c1e4d735f99ff1c4e941fb1cd3 100644 (file)
@@ -139,9 +139,7 @@ is_delegation(const vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node,
        result = dns_db_findrdataset(vctx->db, node, vctx->ver,
                                     dns_rdatatype_ns, 0, 0, &nsset, NULL);
        if (dns_rdataset_isassociated(&nsset)) {
-               if (ttlp != NULL) {
-                       *ttlp = nsset.ttl;
-               }
+               SET_IF_NOT_NULL(ttlp, nsset.ttl);
                dns_rdataset_disassociate(&nsset);
        }
 
index 3c32f76a4aafde701654e59c9c43b49cafae3db2..39c29c9ebf92004a3f6eb249d35a2955ef9dd783 100644 (file)
@@ -492,9 +492,7 @@ tls_try_handshake(isc_nmsocket_t *sock, isc_result_t *presult) {
                isc_nmhandle_detach(&tlshandle);
                sock->tlsstream.state = TLS_IO;
 
-               if (presult != NULL) {
-                       *presult = result;
-               }
+               SET_IF_NOT_NULL(presult, result);
        }
 
        return rv;
index 937bc57604e34c800240cca0e1999d93babeb806..f8e0f4eff32ac0757f41212a81f1ff19066d0c68 100644 (file)
@@ -241,9 +241,7 @@ isccc_alist_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp) {
        if (kv != NULL) {
                v = CDR(kv);
                if (isccc_sexpr_stringp(v)) {
-                       if (strp != NULL) {
-                               *strp = isccc_sexpr_tostring(v);
-                       }
+                       SET_IF_NOT_NULL(strp, isccc_sexpr_tostring(v));
                        return ISC_R_SUCCESS;
                } else {
                        return ISC_R_EXISTS;
@@ -262,9 +260,7 @@ isccc_alist_lookupbinary(isccc_sexpr_t *alist, const char *key,
        if (kv != NULL) {
                v = CDR(kv);
                if (isccc_sexpr_binaryp(v)) {
-                       if (r != NULL) {
-                               *r = isccc_sexpr_tobinary(v);
-                       }
+                       SET_IF_NOT_NULL(r, isccc_sexpr_tobinary(v));
                        return ISC_R_SUCCESS;
                } else {
                        return ISC_R_EXISTS;
index fee7f2e22f111584f9eb38af46da053e54511faa..2df9305f36b4de0e9387239e5b38cf658658a993 100644 (file)
@@ -904,9 +904,7 @@ isccc_cc_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp) {
        if (kv != NULL) {
                v = ISCCC_SEXPR_CDR(kv);
                if (isccc_sexpr_binaryp(v)) {
-                       if (strp != NULL) {
-                               *strp = isccc_sexpr_tostring(v);
-                       }
+                       SET_IF_NOT_NULL(strp, isccc_sexpr_tostring(v));
                        return ISC_R_SUCCESS;
                } else {
                        return ISC_R_EXISTS;
@@ -924,10 +922,9 @@ isccc_cc_lookupuint32(isccc_sexpr_t *alist, const char *key, uint32_t *uintp) {
        if (kv != NULL) {
                v = ISCCC_SEXPR_CDR(kv);
                if (isccc_sexpr_binaryp(v)) {
-                       if (uintp != NULL) {
-                               *uintp = (uint32_t)strtoul(
-                                       isccc_sexpr_tostring(v), NULL, 10);
-                       }
+                       SET_IF_NOT_NULL(uintp, (uint32_t)strtoul(
+                                                      isccc_sexpr_tostring(v),
+                                                      NULL, 10));
                        return ISC_R_SUCCESS;
                } else {
                        return ISC_R_EXISTS;
index 0d93897c3de5ca2b8d22c1fe8981510cf35db32e..2e386a1ffdb9ce1325d30ef36f31be84e0b7c552 100644 (file)
@@ -102,9 +102,7 @@ get_acl_def(const cfg_obj_t *cctx, const char *name, const cfg_obj_t **ret) {
                const char *aclname =
                        cfg_obj_asstring(cfg_tuple_get(acl, "name"));
                if (strcasecmp(aclname, name) == 0) {
-                       if (ret != NULL) {
-                               *ret = cfg_tuple_get(acl, "value");
-                       }
+                       SET_IF_NOT_NULL(ret, cfg_tuple_get(acl, "value"));
                        return ISC_R_SUCCESS;
                }
        }
@@ -210,9 +208,7 @@ count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx,
                        const cfg_obj_t *negated = cfg_tuple_get(ce, "negated");
                        if (!cfg_obj_isvoid(negated)) {
                                ce = negated;
-                               if (has_negative != NULL) {
-                                       *has_negative = true;
-                               }
+                               SET_IF_NOT_NULL(has_negative, true);
                        }
                }