2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

lib/isc/stats.c: Use ->references instead of ->refs

This commit is contained in:
Ondřej Surý
2019-05-20 16:59:48 +02:00
committed by Witold Kręcicki
parent cbe8034dc8
commit f1471bc2e1

View File

@@ -37,7 +37,7 @@ typedef atomic_int_fast64_t isc_stat_t;
struct isc_stats {
unsigned int magic;
isc_mem_t *mctx;
isc_refcount_t refs;
isc_refcount_t references;
int ncounters;
isc_stat_t *counters;
};
@@ -45,16 +45,13 @@ struct isc_stats {
static isc_result_t
create_stats(isc_mem_t *mctx, int ncounters, isc_stats_t **statsp) {
isc_stats_t *stats;
int i;
REQUIRE(statsp != NULL && *statsp == NULL);
stats = isc_mem_get(mctx, sizeof(*stats));
stats->counters = isc_mem_get(mctx, sizeof(isc_stat_t) * ncounters);
isc_refcount_init(&stats->refs, 1);
for (i = 0; i < ncounters; i++) {
atomic_init(&stats->counters[i], 0);
}
isc_refcount_init(&stats->references, 1);
memset(stats->counters, 0, sizeof(isc_stat_t) * ncounters);
stats->mctx = NULL;
isc_mem_attach(mctx, &stats->mctx);
stats->ncounters = ncounters;
@@ -69,7 +66,7 @@ isc_stats_attach(isc_stats_t *stats, isc_stats_t **statsp) {
REQUIRE(ISC_STATS_VALID(stats));
REQUIRE(statsp != NULL && *statsp == NULL);
isc_refcount_increment(&stats->refs);
isc_refcount_increment(&stats->references);
*statsp = stats;
}
@@ -82,7 +79,7 @@ isc_stats_detach(isc_stats_t **statsp) {
stats = *statsp;
*statsp = NULL;
if (isc_refcount_decrement(&stats->refs) == 1) {
if (isc_refcount_decrement(&stats->references) == 1) {
isc_mem_put(stats->mctx, stats->counters,
sizeof(isc_stat_t) * stats->ncounters);
isc_mem_putanddetach(&stats->mctx, stats, sizeof(*stats));