]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use isc_refcount_increment0() where appropriate
authorOndřej Surý <ondrej@sury.org>
Tue, 23 Jul 2019 14:24:50 +0000 (10:24 -0400)
committerOndřej Surý <ondrej@sury.org>
Tue, 14 Jan 2020 12:12:13 +0000 (13:12 +0100)
lib/dns/lib.c
lib/dns/rbtdb.c
lib/isc/unix/socket.c
lib/isc/win32/socket.c
lib/ns/client.c
lib/ns/lib.c

index 629d2151dce3a5434ce6d6818d066c10cc0065fa..1df93d2e6101ca4e84215514d0d45720d9105e93 100644 (file)
@@ -91,7 +91,7 @@ dns_lib_init(void) {
        if (!initialize_done)
                return (ISC_R_FAILURE);
 
-       isc_refcount_increment(&references);
+       isc_refcount_increment0(&references);
 
        return (ISC_R_SUCCESS);
 }
index 97084c7af33657eda5ea36a5a7ac7e96187c5c5e..e54a000a2a0b63318d34023dba3f833792e20114 100644 (file)
@@ -1818,7 +1818,7 @@ delete_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) {
 static inline void
 new_reference(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) {
        INSIST(!ISC_LINK_LINKED(node, deadlink));
-       if (isc_refcount_increment(&node->references) == 0) {
+       if (isc_refcount_increment0(&node->references) == 0) {
                /* this is the first reference to the node */
                isc_refcount_increment0(&rbtdb->node_locks[node->locknum].references);
        }
index b0699f099c47f3e788ff11415126cd06ed53860c..c17965501a797dd93a73260cf853fb096e2f23b6 100644 (file)
@@ -2489,7 +2489,7 @@ socket_create(isc_socketmgr_t *manager0, int pf, isc_sockettype_t type,
                abort();
        }
        sock->threadid = gen_threadid(sock);
-       isc_refcount_increment(&sock->references);
+       isc_refcount_increment0(&sock->references);
        thread = &manager->threads[sock->threadid];
        *socketp = (isc_socket_t *)sock;
 
@@ -3149,7 +3149,7 @@ process_fd(isc__socketthread_t *thread, int fd, bool readable,
                return;
        }
 
-       if (isc_refcount_increment(&sock->references) == 0) {
+       if (isc_refcount_increment0(&sock->references) == 0) {
                /*
                 * Sock is being closed, it will be destroyed, bail.
                 */
@@ -4678,7 +4678,7 @@ isc_socket_accept(isc_socket_t *sock0,
                UNLOCK(&sock->lock);
                return (ISC_R_SHUTTINGDOWN);
        }
-       isc_refcount_increment(&nsock->references);
+       isc_refcount_increment0(&nsock->references);
        nsock->statsindex = sock->statsindex;
 
        dev->ev_sender = ntask;
index 2226374ab9a8986a10b08127a08991f75feb92f4..2d2c67a6bb8f4b3e173967b591260f4030676f70 100644 (file)
@@ -1736,7 +1736,7 @@ isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
        CONSISTENT(sock);
        UNLOCK(&sock->lock);
 
-       isc_refcount_increment(&sock->references);
+       isc_refcount_increment0(&sock->references);
 
        *socketp = sock;
 }
@@ -3114,7 +3114,7 @@ isc_socket_accept(isc_socket_t *sock,
                UNLOCK(&sock->lock);
                return (ISC_R_SHUTTINGDOWN);
        }
-       isc_refcount_increment(&nsock->references);
+       isc_refcount_increment0(&nsock->references);
 
        adev->ev_sender = ntask;
        adev->newsocket = nsock;
index 40d50b9c1d3710b70c357a5c62e6165d39814912..a7878aa8a0cbec39275b487f3a01cd04ccc0dc0e 100644 (file)
@@ -2347,7 +2347,7 @@ clientmgr_attach(ns_clientmgr_t *source, ns_clientmgr_t **targetp) {
        REQUIRE(VALID_MANAGER(source));
        REQUIRE(targetp != NULL && *targetp == NULL);
 
-       oldrefs = isc_refcount_increment(&source->references);
+       oldrefs = isc_refcount_increment0(&source->references);
        isc_log_write(ns_lctx, NS_LOGCATEGORY_CLIENT,
                      NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(3),
                      "clientmgr @%p attach: %d", source, oldrefs + 1);
@@ -2478,7 +2478,6 @@ ns_clientmgr_destroy(ns_clientmgr_t **managerp) {
        isc_result_t result;
        ns_clientmgr_t *manager;
        bool unlock = false;
-       int32_t oldrefs;
 
        REQUIRE(managerp != NULL);
        manager = *managerp;
@@ -2502,8 +2501,7 @@ ns_clientmgr_destroy(ns_clientmgr_t **managerp) {
                isc_task_endexclusive(manager->excl);
        }
 
-       oldrefs = isc_refcount_decrement(&manager->references);
-       if (oldrefs == 1) {
+       if (isc_refcount_decrement(&manager->references) == 1) {
                clientmgr_destroy(manager);
        }
 
index 8e49693eb58fff27ec552012f98f5e0e922b2ddd..f2576632e9215c18bbb41b78e4c1e98a9d66f2d9 100644 (file)
@@ -68,7 +68,7 @@ ns_lib_init(void) {
        if (!initialize_done)
                return (ISC_R_FAILURE);
 
-       isc_refcount_increment(&references);
+       isc_refcount_increment0(&references);
 
        return (ISC_R_SUCCESS);
 }