2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Unify how we use isc_refcount_decrement() to destroy object

The isc_refcount_decrement() was either used as:

    if (isc_refcount_decrement() == 1) { destroy(); }

or

    if (isc_refcount_decrement() != 1) { return; } destroy();

This commits eradicates the last usage of the later, so the code is unified to
use the former.
This commit is contained in:
Ondřej Surý
2019-09-12 09:49:16 +02:00
committed by Mark Andrews
parent c3bcb4d47a
commit ed494fe29d

View File

@@ -2081,10 +2081,7 @@ rpz_detach(dns_rpz_zone_t **rpzp) {
rpz = *rpzp; rpz = *rpzp;
*rpzp = NULL; *rpzp = NULL;
if (isc_refcount_decrement(&rpz->refs) != 1) { if (isc_refcount_decrement(&rpz->refs) == 1) {
return;
}
isc_refcount_destroy(&rpz->refs); isc_refcount_destroy(&rpz->refs);
rpzs = rpz->rpzs; rpzs = rpz->rpzs;
@@ -2146,6 +2143,7 @@ rpz_detach(dns_rpz_zone_t **rpzp) {
isc_mem_put(rpzs->mctx, rpz, sizeof(*rpz)); isc_mem_put(rpzs->mctx, rpz, sizeof(*rpz));
rpz_detach_rpzs(&rpzs); rpz_detach_rpzs(&rpzs);
} }
}
void void
dns_rpz_attach_rpzs(dns_rpz_zones_t *rpzs, dns_rpz_zones_t **rpzsp) { dns_rpz_attach_rpzs(dns_rpz_zones_t *rpzs, dns_rpz_zones_t **rpzsp) {