]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Apply the SET_IF_NOT_NULL() semantic patch
authorTony Finch <fanf@isc.org>
Thu, 6 Apr 2023 15:32:16 +0000 (16:32 +0100)
committerOndřej Surý <ondrej@isc.org>
Tue, 15 Aug 2023 10:21:41 +0000 (12:21 +0200)
    spatch --sp-file cocci/set_if_not_null.spatch --use-gitgrep --dir "." --include-headers --in-place

28 files changed:
bin/dig/dighost.c
bin/dnssec/dnssectool.c
bin/named/config.c
bin/tests/system/rpz/testlib/dummylib.c
bin/tests/system/rpz/testlib/test-data.c
lib/dns/adb.c
lib/dns/key.c
lib/dns/message.c
lib/dns/nsec3.c
lib/dns/openssl_shim.c
lib/dns/rbt-zonedb.c
lib/dns/rdata/in_1/svcb_64.c
lib/dns/resolver.c
lib/dns/rriterator.c
lib/dns/tsig.c
lib/dns/update.c
lib/dns/zone.c
lib/dns/zt.c
lib/isc/hashmap.c
lib/isc/ht.c
lib/isc/include/isc/buffer.h
lib/isc/log.c
lib/isc/netmgr/netmgr.c
lib/isc/stdio.c
lib/isc/symtab.c
lib/isccc/symtab.c
lib/isccfg/check.c
lib/ns/query.c

index 206c166a6b1a62fe632d794924bd51c853900604..bafa54bcd9f4605b81d36422b294c3c928e7d873 100644 (file)
@@ -4543,9 +4543,7 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
        result = isc_getaddresses(host, 0, sockaddrs, DIG_MAX_ADDRESSES,
                                  &count);
        isc_loopmgr_nonblocking(loopmgr);
-       if (resultp != NULL) {
-               *resultp = result;
-       }
+       SET_IF_NOT_NULL(resultp, result);
        if (result != ISC_R_SUCCESS) {
                if (resultp == NULL) {
                        fatal("couldn't get address for '%s': %s", host,
index 0bf8cc78269b3f12bd27f62af216e18ed1ead821..92980a8ca9c0a2a0b28e58ac55f3dedcfe619d51 100644 (file)
@@ -291,15 +291,11 @@ strtotime(const char *str, int64_t now, int64_t base, bool *setp) {
        struct tm tm;
 
        if (isnone(str)) {
-               if (setp != NULL) {
-                       *setp = false;
-               }
+               SET_IF_NOT_NULL(setp, false);
                return ((isc_stdtime_t)0);
        }
 
-       if (setp != NULL) {
-               *setp = true;
-       }
+       SET_IF_NOT_NULL(setp, true);
 
        if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') {
                return ((isc_stdtime_t)0);
index 0f1d3700af2bf7951418713b6e47d52637399d95..f6242ebe843dd0c9b69ba910761badd4cb57e47f 100644 (file)
@@ -952,11 +952,7 @@ named_config_getkeyalgorithm(const char *str, unsigned int *typep,
        } else {
                bits = algorithms[i].size;
        }
-       if (typep != NULL) {
-               *typep = algorithms[i].type;
-       }
-       if (digestbits != NULL) {
-               *digestbits = bits;
-       }
+       SET_IF_NOT_NULL(typep, algorithms[i].type);
+       SET_IF_NOT_NULL(digestbits, bits);
        return (ISC_R_SUCCESS);
 }
index f0e5c50e19936b799be9bd961eedd49bec58c320..9d63e45687af0991eb473dc5669daec81986b69b 100644 (file)
@@ -270,9 +270,7 @@ pack_soa_record(unsigned char *rdatap, size_t rbufsz, size_t *rdlenp,
        rdatap += 4;
        used += (4 * 5);
 
-       if (rdlenp != NULL) {
-               *rdlenp = used;
-       }
+       SET_IF_NOT_NULL(rdlenp, used);
 
        return (true);
 }
@@ -1889,9 +1887,7 @@ domain_pton2(const char *src, u_char *dst, size_t dstsiz, size_t *dstlen,
 
        tptr = tmps;
 
-       if (dstlen != NULL) {
-               *dstlen = 0;
-       }
+       SET_IF_NOT_NULL(dstlen, 0);
 
        while (tptr && *tptr) {
                tok = strsep(&tptr, ".");
@@ -2117,9 +2113,7 @@ trpz_rsp_rr(librpz_emsg_t *emsg, uint16_t *typep, uint16_t *classp,
                        *ttlp = 3600;
                }
 
-               if (typep != NULL) {
-                       *typep = this_rr->type;
-               }
+               SET_IF_NOT_NULL(typep, this_rr->type);
 
                if (rrp != NULL) {
                        uint8_t *copy_src = NULL, *nrdata = NULL;
@@ -2205,9 +2199,7 @@ trpz_rsp_rr(librpz_emsg_t *emsg, uint16_t *typep, uint16_t *classp,
                trsp->rstack[0].result.next_rr = this_rr->rrn;
                last_result->rridx++;
        } else {
-               if (typep != NULL) {
-                       *typep = ns_t_invalid;
-               }
+               SET_IF_NOT_NULL(typep, ns_t_invalid);
 
                if (rrp != NULL) {
                        *rrp = NULL;
index 16f5fbb6fa7f287e46082af01f65b489db759a3a..d48e216b2971bb2045ebf44a7f4e217e321aa126 100644 (file)
@@ -1114,9 +1114,7 @@ sanity_check_data_file(const char *fname, char **errp) {
        FILE *f = NULL;
        int result = -1;
 
-       if (errp != NULL) {
-               *errp = NULL;
-       }
+       SET_IF_NOT_NULL(errp, NULL);
 
        f = fopen(fname, "r");
        if (f == NULL) {
index 7102226bd5f637ca26c589cd9f11e9e8fab2e7d6..fb99b4cf868979a7283993d4b1ef6920576b8d55 100644 (file)
@@ -3691,25 +3691,15 @@ dns_adb_getquota(dns_adb_t *adb, uint32_t *quotap, uint32_t *freqp,
                 double *lowp, double *highp, double *discountp) {
        REQUIRE(DNS_ADB_VALID(adb));
 
-       if (quotap != NULL) {
-               *quotap = adb->quota;
-       }
+       SET_IF_NOT_NULL(quotap, adb->quota);
 
-       if (freqp != NULL) {
-               *freqp = adb->atr_freq;
-       }
+       SET_IF_NOT_NULL(freqp, adb->atr_freq);
 
-       if (lowp != NULL) {
-               *lowp = adb->atr_low;
-       }
+       SET_IF_NOT_NULL(lowp, adb->atr_low);
 
-       if (highp != NULL) {
-               *highp = adb->atr_high;
-       }
+       SET_IF_NOT_NULL(highp, adb->atr_high);
 
-       if (discountp != NULL) {
-               *discountp = adb->atr_discount;
-       }
+       SET_IF_NOT_NULL(discountp, adb->atr_discount);
 }
 
 static bool
index d039ea44449c74318631e4e93fdb786afb4a8838..2449e8aac1c968eface1de34e512860330a97910 100644 (file)
@@ -212,12 +212,8 @@ dst_key_have_ksk_and_zsk(dst_key_t **keys, unsigned int nkeys, unsigned int i,
                }
        }
 
-       if (have_ksk != NULL) {
-               *have_ksk = hksk;
-       }
-       if (have_zsk != NULL) {
-               *have_zsk = hzsk;
-       }
+       SET_IF_NOT_NULL(have_ksk, hksk);
+       SET_IF_NOT_NULL(have_zsk, hzsk);
        return (hksk && hzsk);
 }
 
index a86724a07453a1bb68f42bd36294fe09c5f5e46f..64772533524c364e397c0be05e67e5da6d57aa60 100644 (file)
@@ -2633,12 +2633,8 @@ dns_message_peekheader(isc_buffer_t *source, dns_messageid_t *idp,
        flags = isc_buffer_getuint16(&buffer);
        flags &= DNS_MESSAGE_FLAG_MASK;
 
-       if (flagsp != NULL) {
-               *flagsp = flags;
-       }
-       if (idp != NULL) {
-               *idp = id;
-       }
+       SET_IF_NOT_NULL(flagsp, flags);
+       SET_IF_NOT_NULL(idp, id);
 
        return (ISC_R_SUCCESS);
 }
@@ -2786,9 +2782,7 @@ dns_message_gettsig(dns_message_t *msg, const dns_name_t **owner) {
        REQUIRE(DNS_MESSAGE_VALID(msg));
        REQUIRE(owner == NULL || *owner == NULL);
 
-       if (owner != NULL) {
-               *owner = msg->tsigname;
-       }
+       SET_IF_NOT_NULL(owner, msg->tsigname);
        return (msg->tsig);
 }
 
index 95454df9de71fdbf607b848892b0013075caf529..227ac5c129a8d8916a7637f3d4a50a0f1ff0fde7 100644 (file)
@@ -271,9 +271,7 @@ dns_nsec3_hashname(dns_fixedname_t *result,
                return (DNS_R_BADALG);
        }
 
-       if (hash_length != NULL) {
-               *hash_length = len;
-       }
+       SET_IF_NOT_NULL(hash_length, len);
 
        /* convert the hash to base32hex non-padded */
        region.base = rethash;
index 15e93b61ba7cffe53e42b44b063c074c23d59a38..128ffd3eb19d77d227ec1e513935bd4bd64c5ce7 100644 (file)
@@ -98,39 +98,23 @@ RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp) {
 void
 RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
             const BIGNUM **d) {
-       if (n != NULL) {
-               *n = r->n;
-       }
-       if (e != NULL) {
-               *e = r->e;
-       }
-       if (d != NULL) {
-               *d = r->d;
-       }
+       SET_IF_NOT_NULL(n, r->n);
+       SET_IF_NOT_NULL(e, r->e);
+       SET_IF_NOT_NULL(d, r->d);
 }
 
 void
 RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) {
-       if (p != NULL) {
-               *p = r->p;
-       }
-       if (q != NULL) {
-               *q = r->q;
-       }
+       SET_IF_NOT_NULL(p, r->p);
+       SET_IF_NOT_NULL(q, r->q);
 }
 
 void
 RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
                    const BIGNUM **iqmp) {
-       if (dmp1 != NULL) {
-               *dmp1 = r->dmp1;
-       }
-       if (dmq1 != NULL) {
-               *dmq1 = r->dmq1;
-       }
-       if (iqmp != NULL) {
-               *iqmp = r->iqmp;
-       }
+       SET_IF_NOT_NULL(dmp1, r->dmp1);
+       SET_IF_NOT_NULL(dmq1, r->dmq1);
+       SET_IF_NOT_NULL(iqmp, r->iqmp);
 }
 
 int
@@ -143,12 +127,8 @@ RSA_test_flags(const RSA *r, int flags) {
 /* From OpenSSL 1.1 */
 void
 ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) {
-       if (pr != NULL) {
-               *pr = sig->r;
-       }
-       if (ps != NULL) {
-               *ps = sig->s;
-       }
+       SET_IF_NOT_NULL(pr, sig->r);
+       SET_IF_NOT_NULL(ps, sig->s);
 }
 
 int
@@ -172,9 +152,7 @@ static const char err_empty_string = '\0';
 unsigned long
 ERR_get_error_all(const char **file, int *line, const char **func,
                  const char **data, int *flags) {
-       if (func != NULL) {
-               *func = &err_empty_string;
-       }
+       SET_IF_NOT_NULL(func, &err_empty_string);
        return (ERR_get_error_line_data(file, line, data, flags));
 }
 #endif /* if !HAVE_ERR_GET_ERROR_ALL */
index 1bcb85979fcac04a6ebc973dcd5d4291dbd4506f..8c87191114e5ba259112318414f30b482a2f405b 100644 (file)
@@ -1956,13 +1956,9 @@ getsize(dns_db_t *db, dns_dbversion_t *version, uint64_t *records,
        }
 
        RWLOCK(&rbtversion->rwlock, isc_rwlocktype_read);
-       if (records != NULL) {
-               *records = rbtversion->records;
-       }
+       SET_IF_NOT_NULL(records, rbtversion->records);
 
-       if (xfrsize != NULL) {
-               *xfrsize = rbtversion->xfrsize;
-       }
+       SET_IF_NOT_NULL(xfrsize, rbtversion->xfrsize);
        RWUNLOCK(&rbtversion->rwlock, isc_rwlocktype_read);
        RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_read);
 
index d88cfb7b50315e2acc9339dc97074ab81457e49c..545dd52bf9d996f06ac27cfa72137ccec918548f 100644 (file)
@@ -247,9 +247,7 @@ finish:
                isc_textregion_consume(region, 1);
        }
        RETERR(uint16_tobuffer(ul, target));
-       if (value != NULL) {
-               *value = ul;
-       }
+       SET_IF_NOT_NULL(value, ul);
        return (ISC_R_SUCCESS);
 }
 
index 0af07b8273ef4e0798abb3148172bcd4bc1f279c..fdc4c3437d1d8b37f5885e7106ab6ab77f431c61 100644 (file)
@@ -6854,9 +6854,7 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname,
                result = dns_name_concatenate(&prefix, &dname.dname, tname,
                                              NULL);
                if (result == DNS_R_NAMETOOLONG) {
-                       if (chainingp != NULL) {
-                               *chainingp = true;
-                       }
+                       SET_IF_NOT_NULL(chainingp, true);
                        return (true);
                }
                RUNTIME_CHECK(result == ISC_R_SUCCESS);
@@ -6865,9 +6863,7 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname,
                UNREACHABLE();
        }
 
-       if (chainingp != NULL) {
-               *chainingp = true;
-       }
+       SET_IF_NOT_NULL(chainingp, true);
 
        if (view->denyanswernames == NULL) {
                return (true);
@@ -11014,15 +11010,9 @@ dns_resolver_getclientsperquery(dns_resolver_t *resolver, uint32_t *cur,
        REQUIRE(VALID_RESOLVER(resolver));
 
        LOCK(&resolver->lock);
-       if (cur != NULL) {
-               *cur = resolver->spillat;
-       }
-       if (min != NULL) {
-               *min = resolver->spillatmin;
-       }
-       if (max != NULL) {
-               *max = resolver->spillatmax;
-       }
+       SET_IF_NOT_NULL(cur, resolver->spillat);
+       SET_IF_NOT_NULL(min, resolver->spillatmin);
+       SET_IF_NOT_NULL(max, resolver->spillatmax);
        UNLOCK(&resolver->lock);
 }
 
index 93548bce4d8366c30376fead542ebf4d8a2b2772..49bcd67ebfcf7666f49c69a83e746432a77b237e 100644 (file)
@@ -210,11 +210,7 @@ dns_rriterator_current(dns_rriterator_t *it, dns_name_t **name, uint32_t *ttl,
        dns_rdata_reset(&it->rdata);
        dns_rdataset_current(&it->rdataset, &it->rdata);
 
-       if (rdataset != NULL) {
-               *rdataset = &it->rdataset;
-       }
+       SET_IF_NOT_NULL(rdataset, &it->rdataset);
 
-       if (rdata != NULL) {
-               *rdata = &it->rdata;
-       }
+       SET_IF_NOT_NULL(rdata, &it->rdata);
 }
index 78e73283357901d8760fe575a71b2589b6757b51..fbefeb3ba4b11ffcfe3c6dbed4a1d308b2c042d4 100644 (file)
@@ -290,9 +290,7 @@ dns_tsigkey_createfromkey(const dns_name_t *name, dst_algorithm_t algorithm,
                tsig_log(tkey, ISC_LOG_DEBUG(3), "statically configured");
        }
 
-       if (keyp != NULL) {
-               *keyp = tkey;
-       }
+       SET_IF_NOT_NULL(keyp, tkey);
        return (ISC_R_SUCCESS);
 
 cleanup_name:
index 6d7e563c0f52ceac740b639b60a27d35c72b9cb5..4cfc8142b094722d374d0cab9f88bb5f010855b1 100644 (file)
@@ -851,9 +851,7 @@ is_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, bool *flag,
        if (result == ISC_R_SUCCESS || result == DNS_R_EMPTYNAME) {
                *flag = true;
                *cut = false;
-               if (unsecure != NULL) {
-                       *unsecure = false;
-               }
+               SET_IF_NOT_NULL(unsecure, false);
                return (ISC_R_SUCCESS);
        } else if (result == DNS_R_ZONECUT) {
                *flag = true;
@@ -879,9 +877,7 @@ is_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, bool *flag,
        {
                *flag = false;
                *cut = false;
-               if (unsecure != NULL) {
-                       *unsecure = false;
-               }
+               SET_IF_NOT_NULL(unsecure, false);
                return (ISC_R_SUCCESS);
        } else {
                /*
@@ -889,9 +885,7 @@ is_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, bool *flag,
                 */
                *flag = false;
                *cut = false;
-               if (unsecure != NULL) {
-                       *unsecure = false;
-               }
+               SET_IF_NOT_NULL(unsecure, false);
                return (result);
        }
 }
@@ -2231,9 +2225,7 @@ dns_update_soaserial(uint32_t serial, dns_updatemethod_t method,
                UNREACHABLE();
        }
 
-       if (used != NULL) {
-               *used = method;
-       }
+       SET_IF_NOT_NULL(used, method);
 
        return (new_serial);
 }
index 21a906813b1cccbc2be00e65dc20dce65dac83af..a99817294d81525e9401ea66676f334e71f280cf 100644 (file)
  */
 #define RANGE(a, min, max) (((a) < (min)) ? (min) : ((a) < (max) ? (a) : (max)))
 
-#define NSEC3REMOVE(x) (((x) & DNS_NSEC3FLAG_REMOVE) != 0)
+#define NSEC3REMOVE(x) (((x)&DNS_NSEC3FLAG_REMOVE) != 0)
 
 /*%
  * Key flags
@@ -5459,12 +5459,8 @@ zone_count_ns_rr(dns_zone_t *zone, dns_db_t *db, dns_dbnode_t *node,
        dns_rdataset_disassociate(&rdataset);
 
 success:
-       if (nscount != NULL) {
-               *nscount = count;
-       }
-       if (errors != NULL) {
-               *errors = ecount;
-       }
+       SET_IF_NOT_NULL(nscount, count);
+       SET_IF_NOT_NULL(errors, ecount);
 
        result = ISC_R_SUCCESS;
 
index 01bed3c290b03f2b145e902aecef216493b9ec9d..76eea010c0541c4c8e8b331a24f6246da5b3a522 100644 (file)
@@ -527,9 +527,7 @@ dns_zt_apply(dns_zt_t *zt, bool stop, isc_result_t *sub,
        }
        dns_qpread_destroy(zt->multi, &qpr);
 
-       if (sub != NULL) {
-               *sub = tresult;
-       }
+       SET_IF_NOT_NULL(sub, tresult);
 
        return (result);
 }
index d5d8eb13bbc6b4ca16afcd70cb6977f0fdac5a89..12c1822b9b1a97235a0ac40a0a88da7fb17ce745 100644 (file)
@@ -347,9 +347,7 @@ isc_hashmap_find(const isc_hashmap_t *hashmap, const uint32_t *hashvalp,
        }
 
        INSIST(node->key != NULL);
-       if (valuep != NULL) {
-               *valuep = node->value;
-       }
+       SET_IF_NOT_NULL(valuep, node->value);
        return (ISC_R_SUCCESS);
 }
 
index 4d771882dd7c2f7a59dc902c89079fb6c15dd2de..6f2ff5e60ac83bcb72f85bb4a55039120e61f62c 100644 (file)
@@ -372,9 +372,7 @@ isc_ht_find(const isc_ht_t *ht, const unsigned char *key,
                return (ISC_R_NOTFOUND);
        }
 
-       if (valuep != NULL) {
-               *valuep = node->value;
-       }
+       SET_IF_NOT_NULL(valuep, node->value);
        return (ISC_R_SUCCESS);
 }
 
index 4e73c9c7c5771832cd5bb023b029fea85093f515..18f671deb9c5fb8e5dae12ba4bedfe60c7d0cfe5 100644 (file)
@@ -844,9 +844,7 @@ isc_buffer_peekuint8(const isc_buffer_t *restrict b, uint8_t *valp) {
        ISC_BUFFER_PEEK_CHECK(b, sizeof(*valp));
 
        uint8_t *cp = isc_buffer_current(b);
-       if (valp != NULL) {
-               *valp = (uint8_t)(cp[0]);
-       }
+       SET_IF_NOT_NULL(valp, (uint8_t)(cp[0]));
        return (ISC_R_SUCCESS);
 }
 
@@ -887,9 +885,7 @@ isc_buffer_peekuint16(const isc_buffer_t *restrict b, uint16_t *valp) {
 
        uint8_t *cp = isc_buffer_current(b);
 
-       if (valp != NULL) {
-               *valp = ISC_U8TO16_BE(cp);
-       }
+       SET_IF_NOT_NULL(valp, ISC_U8TO16_BE(cp));
        return (ISC_R_SUCCESS);
 }
 
@@ -917,9 +913,7 @@ isc_buffer_peekuint32(const isc_buffer_t *restrict b, uint32_t *valp) {
 
        uint8_t *cp = isc_buffer_current(b);
 
-       if (valp != NULL) {
-               *valp = ISC_U8TO32_BE(cp);
-       }
+       SET_IF_NOT_NULL(valp, ISC_U8TO32_BE(cp));
        return (ISC_R_SUCCESS);
 }
 
@@ -948,9 +942,7 @@ isc_buffer_peekuint48(const isc_buffer_t *restrict b, uint64_t *valp) {
 
        uint8_t *cp = isc_buffer_current(b);
 
-       if (valp != NULL) {
-               *valp = ISC_U8TO48_BE(cp);
-       }
+       SET_IF_NOT_NULL(valp, ISC_U8TO48_BE(cp));
        return (ISC_R_SUCCESS);
 }
 
index 51369af4c0abd2f5332d79b85b2e2ae9c9b88bf7..f923a16e6108a4a721ad7e4ef70cf3dfd740edf6 100644 (file)
@@ -288,9 +288,7 @@ isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp, isc_logconfig_t **lcfgp) {
        atomic_init(&lctx->dynamic, lcfg->dynamic);
 
        *lctxp = lctx;
-       if (lcfgp != NULL) {
-               *lcfgp = lcfg;
-       }
+       SET_IF_NOT_NULL(lcfgp, lcfg);
 }
 
 void
index c861751555603ef120be3781918d481c4d1be107..0f1ab466a78ecdc9b08527d9e0218893d7d2a9db 100644 (file)
@@ -384,21 +384,13 @@ isc_nm_gettimeouts(isc_nm_t *mgr, uint32_t *initial, uint32_t *idle,
                   uint32_t *keepalive, uint32_t *advertised) {
        REQUIRE(VALID_NM(mgr));
 
-       if (initial != NULL) {
-               *initial = atomic_load_relaxed(&mgr->init);
-       }
+       SET_IF_NOT_NULL(initial, atomic_load_relaxed(&mgr->init));
 
-       if (idle != NULL) {
-               *idle = atomic_load_relaxed(&mgr->idle);
-       }
+       SET_IF_NOT_NULL(idle, atomic_load_relaxed(&mgr->idle));
 
-       if (keepalive != NULL) {
-               *keepalive = atomic_load_relaxed(&mgr->keepalive);
-       }
+       SET_IF_NOT_NULL(keepalive, atomic_load_relaxed(&mgr->keepalive));
 
-       if (advertised != NULL) {
-               *advertised = atomic_load_relaxed(&mgr->advertised);
-       }
+       SET_IF_NOT_NULL(advertised, atomic_load_relaxed(&mgr->advertised));
 }
 
 bool
index ad987c66d5fb07e424cc95660999403e60e9016b..601dcc17581ce12b22a74c396d96f91c140fe022 100644 (file)
@@ -85,9 +85,7 @@ isc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f, size_t *nret) {
                        result = isc__errno2result(errno);
                }
        }
-       if (nret != NULL) {
-               *nret = r;
-       }
+       SET_IF_NOT_NULL(nret, r);
        return (result);
 }
 
@@ -102,9 +100,7 @@ isc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f,
        if (r != nmemb) {
                result = isc__errno2result(errno);
        }
-       if (nret != NULL) {
-               *nret = r;
-       }
+       SET_IF_NOT_NULL(nret, r);
        return (result);
 }
 
index c4cbcabbbe61b298e828bc5a92c34038ba791384..f8028a2ca50c13723a1fcb68ebd35f2726f09bc5 100644 (file)
@@ -161,9 +161,7 @@ isc_symtab_lookup(isc_symtab_t *symtab, const char *key, unsigned int type,
                return (ISC_R_NOTFOUND);
        }
 
-       if (value != NULL) {
-               *value = elt->value;
-       }
+       SET_IF_NOT_NULL(value, elt->value);
 
        return (ISC_R_SUCCESS);
 }
index 9260c211bb8dc650d1280301aa1697d05b7c38ff..15ab4fc2ca0f06ccfb2917b9cfb46fe1809df5ba 100644 (file)
@@ -198,9 +198,7 @@ isccc_symtab_lookup(isccc_symtab_t *symtab, const char *key, unsigned int type,
                return (ISC_R_NOTFOUND);
        }
 
-       if (value != NULL) {
-               *value = elt->value;
-       }
+       SET_IF_NOT_NULL(value, elt->value);
 
        return (ISC_R_SUCCESS);
 }
index 44be487daa52d16a11e2b01ce6116db18577d04e..2098030283f22b5ac7bf7bb513cacf31a42fdf04 100644 (file)
@@ -1144,9 +1144,7 @@ check_port(const cfg_obj_t *options, isc_log_t *logctx, const char *type,
                return (ISC_R_RANGE);
        }
 
-       if (portp != NULL) {
-               *portp = (in_port_t)cfg_obj_asuint32(portobj);
-       }
+       SET_IF_NOT_NULL(portp, (in_port_t)cfg_obj_asuint32(portobj));
        return (ISC_R_SUCCESS);
 }
 
index 9d4ba5c13cc084093aa3f71b254f2c5ff7589eaa..1212ed16e173c9a8ad13df15a99dc082fe34cde5 100644 (file)
@@ -1092,9 +1092,7 @@ query_validatezonedb(ns_client_t *client, const dns_name_t *name,
 
 approved:
        /* Transfer ownership, if necessary. */
-       if (versionp != NULL) {
-               *versionp = dbversion->version;
-       }
+       SET_IF_NOT_NULL(versionp, dbversion->version);
        return (ISC_R_SUCCESS);
 }
 
@@ -1495,9 +1493,7 @@ query_isduplicate(ns_client_t *client, dns_name_t *name, dns_rdatatype_t type,
                mname = NULL;
        }
 
-       if (mnamep != NULL) {
-               *mnamep = mname;
-       }
+       SET_IF_NOT_NULL(mnamep, mname);
 
        CTRACE(ISC_LOG_DEBUG(3), "query_isduplicate: false: done");
        return (false);