mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 03:09:59 -04:00
Add dns_rdataset_cleanup() that conditionally disassociate rdataset
We had a common pattern in the code that looks like this:
if (dns_rdataset_isassociated(rdataset)) {
dns_rdataset_disassociate(rdataset);
}
add a helper macro that checks for rdataset != NULL and the above
called dns_rdataset_cleanup(rdataset).
This commit is contained in:
parent
d00f69e450
commit
cabe3aee3b
1 changed files with 4 additions and 0 deletions
|
|
@ -285,6 +285,10 @@ dns_rdataset_invalidate(dns_rdataset_t *rdataset);
|
|||
* without initializing it will cause an assertion failure.
|
||||
*/
|
||||
|
||||
#define dns_rdataset_cleanup(rdataset) \
|
||||
if (rdataset != NULL && dns_rdataset_isassociated(rdataset)) { \
|
||||
dns__rdataset_disassociate(rdataset DNS__DB_FILELINE); \
|
||||
}
|
||||
#define dns_rdataset_disassociate(rdataset) \
|
||||
dns__rdataset_disassociate(rdataset DNS__DB_FILELINE)
|
||||
void
|
||||
|
|
|
|||
Loading…
Reference in a new issue