From: Ondřej Surý Date: Wed, 8 Oct 2025 15:34:12 +0000 (+0200) Subject: Apply the changes from updated set_if_not_null semantic patch X-Git-Tag: v9.21.15~73^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94b4d105e8526cfbf35d5e71d614c0b0aa456cb3;p=thirdparty%2Fbind9.git Apply the changes from updated set_if_not_null semantic patch --- diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 496cfbfeeee..61bb17be4e1 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -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); } diff --git a/bin/dnssec/dnssectool.c b/bin/dnssec/dnssectool.c index 5a1693fe6af..a0eb9f87025 100644 --- a/bin/dnssec/dnssectool.c +++ b/bin/dnssec/dnssectool.c @@ -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); diff --git a/lib/dns/badcache.c b/lib/dns/badcache.c index 8ba10d6e6e1..06de7aa4dc8 100644 --- a/lib/dns/badcache.c +++ b/lib/dns/badcache.c @@ -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(); diff --git a/lib/dns/keymgr.c b/lib/dns/keymgr.c index 81f689fe712..63177b68d55 100644 --- a/lib/dns/keymgr.c +++ b/lib/dns/keymgr.c @@ -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; } } diff --git a/lib/dns/message.c b/lib/dns/message.c index e773a419d47..e777ed99dfe 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -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; } } diff --git a/lib/dns/nsec3.c b/lib/dns/nsec3.c index 64ddbc3614c..48a3aede03d 100644 --- a/lib/dns/nsec3.c +++ b/lib/dns/nsec3.c @@ -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; } diff --git a/lib/dns/private.c b/lib/dns/private.c index ca2d74d7ab0..41b854f3d84 100644 --- a/lib/dns/private.c +++ b/lib/dns/private.c @@ -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); } } diff --git a/lib/dns/qpzone.c b/lib/dns/qpzone.c index f6d0e30ee19..834af41b973 100644 --- a/lib/dns/qpzone.c +++ b/lib/dns/qpzone.c @@ -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); diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 61ec6191f66..09b0db084fe 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -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. */ diff --git a/lib/dns/update.c b/lib/dns/update.c index c5a749e5036..f228a96ceac 100644 --- a/lib/dns/update.c +++ b/lib/dns/update.c @@ -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; diff --git a/lib/dns/zoneverify.c b/lib/dns/zoneverify.c index cf5c65e84f1..2451c2bcdf5 100644 --- a/lib/dns/zoneverify.c +++ b/lib/dns/zoneverify.c @@ -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); } diff --git a/lib/isc/netmgr/tlsstream.c b/lib/isc/netmgr/tlsstream.c index 3c32f76a4aa..39c29c9ebf9 100644 --- a/lib/isc/netmgr/tlsstream.c +++ b/lib/isc/netmgr/tlsstream.c @@ -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; diff --git a/lib/isccc/alist.c b/lib/isccc/alist.c index 937bc57604e..f8e0f4eff32 100644 --- a/lib/isccc/alist.c +++ b/lib/isccc/alist.c @@ -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; diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c index fee7f2e22f1..2df9305f36b 100644 --- a/lib/isccc/cc.c +++ b/lib/isccc/cc.c @@ -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; diff --git a/lib/isccfg/aclconf.c b/lib/isccfg/aclconf.c index 0d93897c3de..2e386a1ffdb 100644 --- a/lib/isccfg/aclconf.c +++ b/lib/isccfg/aclconf.c @@ -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); } }