2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Rewrite isc_refcount API to fetch_and_<op>, instead of former <op>_and_<fetch>

This commit is contained in:
Ondřej Surý
2018-08-17 15:16:59 +02:00
parent 7fbbf09d21
commit bef8ac5bae
24 changed files with 254 additions and 468 deletions

View File

@@ -61,19 +61,16 @@ struct dns_nta {
*/
static void
nta_ref(dns_nta_t *nta) {
isc_refcount_increment(&nta->refcount, NULL);
isc_refcount_increment(&nta->refcount);
}
static void
nta_detach(isc_mem_t *mctx, dns_nta_t **ntap) {
unsigned int refs;
dns_nta_t *nta = *ntap;
REQUIRE(VALID_NTA(nta));
*ntap = NULL;
isc_refcount_decrement(&nta->refcount, &refs);
if (refs == 0) {
if (isc_refcount_decrement(&nta->refcount) == 1) {
nta->magic = 0;
if (nta->timer != NULL) {
(void) isc_timer_reset(nta->timer,
@@ -92,6 +89,7 @@ nta_detach(isc_mem_t *mctx, dns_nta_t **ntap) {
}
isc_mem_put(mctx, nta, sizeof(dns_nta_t));
}
*ntap = NULL;
}
static void