Commit 7c3e3429 authored by Ondřej Surý's avatar Ondřej Surý

Use isc_refcount_increment0() where appropriate

parent 9ce3254a
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment