2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +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

@@ -340,7 +340,7 @@ ns_interfacemgr_getaclenv(ns_interfacemgr_t *mgr) {
void
ns_interfacemgr_attach(ns_interfacemgr_t *source, ns_interfacemgr_t **target) {
REQUIRE(NS_INTERFACEMGR_VALID(source));
INSIST(isc_refcount_increment(&source->references) > 0);
isc_refcount_increment(&source->references);
*target = source;
}