2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

Remove duplicate INSIST checks for isc_refcount API

This commits removes superfluous checks when using the isc_refcount API.

Examples of superfluous checks:

1. The isc_refcount_decrement function ensures there was not underflow,
   so this check is superfluous:

    INSIST(isc_refcount_decrement(&r) > 0);

2 .The isc_refcount_destroy() includes check whether the counter
   is zero, therefore this is superfluous:

    INSIST(isc_refcount_decrement(&r) == 1 && isc_refcount_destroy(&r));
This commit is contained in:
Ondřej Surý
2019-07-15 11:19:03 +02:00
parent e711b0304f
commit 6afa99362a
7 changed files with 18 additions and 19 deletions

View File

@@ -1484,9 +1484,9 @@ cleanup_task:
dns_rbt_destroy(&zones->rbt);
cleanup_rbt:
INSIST(isc_refcount_decrement(&zones->irefs) == 1);
isc_refcount_decrement(&zones->irefs);
isc_refcount_destroy(&zones->irefs);
INSIST(isc_refcount_decrement(&zones->refs) == 1);
isc_refcount_decrement(&zones->refs);
isc_refcount_destroy(&zones->refs);
isc_mutex_destroy(&zones->maint_lock);
@@ -1567,7 +1567,7 @@ cleanup_ht:
isc_timer_detach(&zone->updatetimer);
cleanup_timer:
INSIST(isc_refcount_decrement(&zone->refs) > 0);
isc_refcount_decrement(&zone->refs);
isc_refcount_destroy(&zone->refs);
isc_mem_put(rpzs->mctx, zone, sizeof(*zone));