From: Ondřej Surý Date: Tue, 23 Jul 2019 14:24:50 +0000 (-0400) Subject: Use isc_refcount_increment0() where appropriate X-Git-Tag: v9.15.8~10^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c3e342935cad745b424a1469d86b9ec24fd1e48;p=thirdparty%2Fbind9.git Use isc_refcount_increment0() where appropriate --- diff --git a/lib/dns/lib.c b/lib/dns/lib.c index 629d2151dce..1df93d2e610 100644 --- a/lib/dns/lib.c +++ b/lib/dns/lib.c @@ -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); } diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 97084c7af33..e54a000a2a0 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -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); } diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index b0699f099c4..c17965501a7 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -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; diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index 2226374ab9a..2d2c67a6bb8 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -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; diff --git a/lib/ns/client.c b/lib/ns/client.c index 40d50b9c1d3..a7878aa8a0c 100644 --- a/lib/ns/client.c +++ b/lib/ns/client.c @@ -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); } diff --git a/lib/ns/lib.c b/lib/ns/lib.c index 8e49693eb58..f2576632e92 100644 --- a/lib/ns/lib.c +++ b/lib/ns/lib.c @@ -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); }