diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-03-20 11:39:40 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-07-31 11:50:27 +0200 |
commit | 6079675bdb652045eff48880b0d9938b3e7e79ad (patch) | |
tree | af0651e53b2cd9023ee69ea5f29cdf6603bac1e7 /src/counter.c | |
parent | 7b4a05d535f0ecc070e9b506ad0a667e24b67f71 (diff) |
make use of OTC_GLOBAL when allocating library-internal contexts
As libosmcore is now managing the global talloc contexts, there's
no point in having APIs where the user tells the library about
which talloc contexts to use for a given sub-system.
Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1
Diffstat (limited to 'src/counter.c')
-rw-r--r-- | src/counter.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/counter.c b/src/counter.c index 0fa31661..482dfc29 100644 --- a/src/counter.c +++ b/src/counter.c @@ -1,7 +1,7 @@ /*! \file counter.c * utility routines for keeping some statistics. */ /* - * (C) 2009 by Harald Welte <laforge@gnumonks.org> + * (C) 2009,2019 by Harald Welte <laforge@gnumonks.org> * * All Rights Reserved * @@ -39,8 +39,12 @@ void *tall_ctr_ctx; * \returns Allocated counter on success; NULL on error */ struct osmo_counter *osmo_counter_alloc(const char *name) { - struct osmo_counter *ctr = talloc_zero(tall_ctr_ctx, struct osmo_counter); + struct osmo_counter *ctr; + + if (!tall_ctr_ctx) + tall_ctr_ctx = talloc_named_const(OTC_GLOBAL, 0, "osmo_counter"); + ctr = talloc_zero(tall_ctr_ctx, struct osmo_counter); if (!ctr) return NULL; |