diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 55168fa699..db8c89e79e 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -4553,9 +4553,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; - } + OUTARG(resultp, result); if (result != ISC_R_SUCCESS) { if (resultp == NULL) { fatal("couldn't get address for '%s': %s", host, diff --git a/bin/dnssec/dnssectool.c b/bin/dnssec/dnssectool.c index 0bf8cc7826..7489d5b988 100644 --- a/bin/dnssec/dnssectool.c +++ b/bin/dnssec/dnssectool.c @@ -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; - } + OUTARG(setp, false); return ((isc_stdtime_t)0); } - if (setp != NULL) { - *setp = true; - } + OUTARG(setp, true); if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') { return ((isc_stdtime_t)0); diff --git a/bin/named/config.c b/bin/named/config.c index 2149b29b85..150d71b229 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -984,11 +984,7 @@ named_config_getkeyalgorithm2(const char *str, const dns_name_t **name, UNREACHABLE(); } } - if (typep != NULL) { - *typep = algorithms[i].type; - } - if (digestbits != NULL) { - *digestbits = bits; - } + OUTARG(typep, algorithms[i].type); + OUTARG(digestbits, bits); return (ISC_R_SUCCESS); } diff --git a/bin/tests/system/rpz/testlib/dummylib.c b/bin/tests/system/rpz/testlib/dummylib.c index f0e5c50e19..a035ef12a2 100644 --- a/bin/tests/system/rpz/testlib/dummylib.c +++ b/bin/tests/system/rpz/testlib/dummylib.c @@ -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; - } + OUTARG(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; - } + OUTARG(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; - } + OUTARG(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; - } + OUTARG(typep, ns_t_invalid); if (rrp != NULL) { *rrp = NULL; diff --git a/bin/tests/system/rpz/testlib/test-data.c b/bin/tests/system/rpz/testlib/test-data.c index 0906702090..3773a6ebd3 100644 --- a/bin/tests/system/rpz/testlib/test-data.c +++ b/bin/tests/system/rpz/testlib/test-data.c @@ -1113,9 +1113,7 @@ sanity_check_data_file(const char *fname, char **errp) { FILE *f = NULL; int result = -1; - if (errp != NULL) { - *errp = NULL; - } + OUTARG(errp, NULL); f = fopen(fname, "r"); if (f == NULL) { diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 8fe368445f..55399f5c14 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -3696,25 +3696,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; - } + OUTARG(quotap, adb->quota); - if (freqp != NULL) { - *freqp = adb->atr_freq; - } + OUTARG(freqp, adb->atr_freq); - if (lowp != NULL) { - *lowp = adb->atr_low; - } + OUTARG(lowp, adb->atr_low); - if (highp != NULL) { - *highp = adb->atr_high; - } + OUTARG(highp, adb->atr_high); - if (discountp != NULL) { - *discountp = adb->atr_discount; - } + OUTARG(discountp, adb->atr_discount); } static bool diff --git a/lib/dns/message.c b/lib/dns/message.c index 120e3680e9..58820d84e8 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -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; - } + OUTARG(flagsp, flags); + OUTARG(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; - } + OUTARG(owner, msg->tsigname); return (msg->tsig); } diff --git a/lib/dns/nsec3.c b/lib/dns/nsec3.c index b0688139f5..24cc3e5877 100644 --- a/lib/dns/nsec3.c +++ b/lib/dns/nsec3.c @@ -271,9 +271,7 @@ dns_nsec3_hashname(dns_fixedname_t *result, return (DNS_R_BADALG); } - if (hash_length != NULL) { - *hash_length = len; - } + OUTARG(hash_length, len); /* convert the hash to base32hex non-padded */ region.base = rethash; diff --git a/lib/dns/openssl_shim.c b/lib/dns/openssl_shim.c index 15e93b61ba..09b11ad4c6 100644 --- a/lib/dns/openssl_shim.c +++ b/lib/dns/openssl_shim.c @@ -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; - } + OUTARG(n, r->n); + OUTARG(e, r->e); + OUTARG(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; - } + OUTARG(p, r->p); + OUTARG(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; - } + OUTARG(dmp1, r->dmp1); + OUTARG(dmq1, r->dmq1); + OUTARG(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; - } + OUTARG(pr, sig->r); + OUTARG(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; - } + OUTARG(func, &err_empty_string); return (ERR_get_error_line_data(file, line, data, flags)); } #endif /* if !HAVE_ERR_GET_ERROR_ALL */ diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 45a0637f61..7701c0363c 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -7892,13 +7892,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; - } + OUTARG(records, rbtversion->records); - if (xfrsize != NULL) { - *xfrsize = rbtversion->xfrsize; - } + OUTARG(xfrsize, rbtversion->xfrsize); RWUNLOCK(&rbtversion->rwlock, isc_rwlocktype_read); RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_read); diff --git a/lib/dns/rdata/in_1/svcb_64.c b/lib/dns/rdata/in_1/svcb_64.c index d88cfb7b50..975794f935 100644 --- a/lib/dns/rdata/in_1/svcb_64.c +++ b/lib/dns/rdata/in_1/svcb_64.c @@ -247,9 +247,7 @@ finish: isc_textregion_consume(region, 1); } RETERR(uint16_tobuffer(ul, target)); - if (value != NULL) { - *value = ul; - } + OUTARG(value, ul); return (ISC_R_SUCCESS); } diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index e472c6e78e..1044fb2841 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -6841,9 +6841,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; - } + OUTARG(chainingp, true); return (true); } RUNTIME_CHECK(result == ISC_R_SUCCESS); @@ -6852,9 +6850,7 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname, UNREACHABLE(); } - if (chainingp != NULL) { - *chainingp = true; - } + OUTARG(chainingp, true); if (view->denyanswernames == NULL) { return (true); @@ -10959,15 +10955,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; - } + OUTARG(cur, resolver->spillat); + OUTARG(min, resolver->spillatmin); + OUTARG(max, resolver->spillatmax); UNLOCK(&resolver->lock); } diff --git a/lib/dns/rriterator.c b/lib/dns/rriterator.c index 93548bce4d..0cad69b672 100644 --- a/lib/dns/rriterator.c +++ b/lib/dns/rriterator.c @@ -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; - } + OUTARG(rdataset, &it->rdataset); - if (rdata != NULL) { - *rdata = &it->rdata; - } + OUTARG(rdata, &it->rdata); } diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index 888c1a4fb1..1bb92b54b8 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -336,9 +336,7 @@ dns_tsigkey_createfromkey(const dns_name_t *name, const dns_name_t *algorithm, namestr); } - if (key != NULL) { - *key = tkey; - } + OUTARG(key, tkey); if (tkey->restored) { tsig_log(tkey, ISC_LOG_DEBUG(3), "restored from file"); diff --git a/lib/dns/update.c b/lib/dns/update.c index c547c041a8..634797d847 100644 --- a/lib/dns/update.c +++ b/lib/dns/update.c @@ -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; - } + OUTARG(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; - } + OUTARG(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; - } + OUTARG(unsecure, false); return (result); } } @@ -2267,9 +2261,7 @@ dns_update_soaserial(uint32_t serial, dns_updatemethod_t method, UNREACHABLE(); } - if (used != NULL) { - *used = method; - } + OUTARG(used, method); return (new_serial); } diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 5dd59da646..a99e905d89 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -5455,12 +5455,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; - } + OUTARG(nscount, count); + OUTARG(errors, ecount); result = ISC_R_SUCCESS; diff --git a/lib/dns/zt.c b/lib/dns/zt.c index cf91f7285b..5095729195 100644 --- a/lib/dns/zt.c +++ b/lib/dns/zt.c @@ -531,9 +531,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; - } + OUTARG(sub, tresult); return (result); } diff --git a/lib/isc/hashmap.c b/lib/isc/hashmap.c index d5d8eb13bb..120f9e1148 100644 --- a/lib/isc/hashmap.c +++ b/lib/isc/hashmap.c @@ -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; - } + OUTARG(valuep, node->value); return (ISC_R_SUCCESS); } diff --git a/lib/isc/ht.c b/lib/isc/ht.c index d9de112e54..d900772f23 100644 --- a/lib/isc/ht.c +++ b/lib/isc/ht.c @@ -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; - } + OUTARG(valuep, node->value); return (ISC_R_SUCCESS); } diff --git a/lib/isc/include/isc/buffer.h b/lib/isc/include/isc/buffer.h index 4e73c9c7c5..4d3b662aaa 100644 --- a/lib/isc/include/isc/buffer.h +++ b/lib/isc/include/isc/buffer.h @@ -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]); - } + OUTARG(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); - } + OUTARG(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); - } + OUTARG(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); - } + OUTARG(valp, ISC_U8TO48_BE(cp)); return (ISC_R_SUCCESS); } diff --git a/lib/isc/log.c b/lib/isc/log.c index a24e1c37fe..af336a4e7a 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -286,9 +286,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; - } + OUTARG(lcfgp, lcfg); } void diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index 4fcc26e5ff..7d5703637c 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -386,21 +386,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); - } + OUTARG(initial, atomic_load_relaxed(&mgr->init)); - if (idle != NULL) { - *idle = atomic_load_relaxed(&mgr->idle); - } + OUTARG(idle, atomic_load_relaxed(&mgr->idle)); - if (keepalive != NULL) { - *keepalive = atomic_load_relaxed(&mgr->keepalive); - } + OUTARG(keepalive, atomic_load_relaxed(&mgr->keepalive)); - if (advertised != NULL) { - *advertised = atomic_load_relaxed(&mgr->advertised); - } + OUTARG(advertised, atomic_load_relaxed(&mgr->advertised)); } bool diff --git a/lib/isc/stdio.c b/lib/isc/stdio.c index ad987c66d5..aa8b0f0688 100644 --- a/lib/isc/stdio.c +++ b/lib/isc/stdio.c @@ -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; - } + OUTARG(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; - } + OUTARG(nret, r); return (result); } diff --git a/lib/isc/symtab.c b/lib/isc/symtab.c index c4cbcabbbe..2e47ac3ef9 100644 --- a/lib/isc/symtab.c +++ b/lib/isc/symtab.c @@ -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; - } + OUTARG(value, elt->value); return (ISC_R_SUCCESS); } diff --git a/lib/isc/thread.c b/lib/isc/thread.c index 7d2c81872f..8e6a95db0b 100644 --- a/lib/isc/thread.c +++ b/lib/isc/thread.c @@ -132,9 +132,7 @@ isc_thread_join(isc_thread_t thread, isc_threadresult_t *result) { PTHREADS_RUNTIME_CHECK(pthread_join, ret); struct thread_wrap *wrap = wrap_v; - if (result != NULL) { - *result = wrap->result; - } + OUTARG(result, wrap->result); free(wrap->jemalloc_enforce_init); free(wrap); } diff --git a/lib/isccc/symtab.c b/lib/isccc/symtab.c index 9260c211bb..f5c1e91b45 100644 --- a/lib/isccc/symtab.c +++ b/lib/isccc/symtab.c @@ -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; - } + OUTARG(value, elt->value); return (ISC_R_SUCCESS); } diff --git a/lib/isccfg/check.c b/lib/isccfg/check.c index b055377913..1007f7f5b0 100644 --- a/lib/isccfg/check.c +++ b/lib/isccfg/check.c @@ -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); - } + OUTARG(portp, (in_port_t)cfg_obj_asuint32(portobj)); return (ISC_R_SUCCESS); } diff --git a/lib/ns/query.c b/lib/ns/query.c index 83413ec0ec..9c98c75a92 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -1089,9 +1089,7 @@ query_validatezonedb(ns_client_t *client, const dns_name_t *name, approved: /* Transfer ownership, if necessary. */ - if (versionp != NULL) { - *versionp = dbversion->version; - } + OUTARG(versionp, dbversion->version); return (ISC_R_SUCCESS); } @@ -1492,9 +1490,7 @@ query_isduplicate(ns_client_t *client, dns_name_t *name, dns_rdatatype_t type, mname = NULL; } - if (mnamep != NULL) { - *mnamep = mname; - } + OUTARG(mnamep, mname); CTRACE(ISC_LOG_DEBUG(3), "query_isduplicate: false: done"); return (false);