]> git.ipfire.org Git - thirdparty/bind9.git/commit
A SET_IF_NOT_NULL() macro for optional return values
authorTony Finch <fanf@isc.org>
Thu, 6 Apr 2023 10:30:00 +0000 (11:30 +0100)
committerOndřej Surý <ondrej@isc.org>
Tue, 15 Aug 2023 10:04:29 +0000 (12:04 +0200)
commit0d6dcd217de63e4d137e6c4461694514be21d676
tree4b97ba5a18da9fb8cab4afe75ee94e186d78cfb3
parent5a36bebfce71698dbd4c34233f2b1c0687210fd5
A SET_IF_NOT_NULL() macro for optional return values

The SET_IF_NOT_NULL() macro avoids a fair amount of tedious boilerplate,
checking pointer parameters to see if they're non-NULL and updating
them if they are.  The macro was already in the dns_zone unit, and this
commit moves it to the <isc/util.h> header.

I have included a Coccinelle semantic patch to use SET_IF_NOT_NULL()
where appropriate. The patch needs an #include in `openssl_shim.c`
in order to work.
cocci/set_if_not_null.spatch [new file with mode: 0644]
lib/dns/openssl_shim.c
lib/dns/zone.c
lib/isc/histo.c
lib/isc/include/isc/util.h