From 7bfc26749662e3a3227037cce4a24748343b50be Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 28 Jul 2009 00:41:45 +0200 Subject: move allocation of talloc contexts into link-time constructor This is much more optimal than checking if the context exists every time we allocate the respective object. --- openbsc/src/paging.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'openbsc/src/paging.c') diff --git a/openbsc/src/paging.c b/openbsc/src/paging.c index 0703e932f..b63a717b0 100644 --- a/openbsc/src/paging.c +++ b/openbsc/src/paging.c @@ -219,9 +219,6 @@ static void _paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr, struct gsm_bts_paging_state *bts_entry = &bts->paging; struct gsm_paging_request *req; - if (!tall_paging_ctx) - tall_paging_ctx = talloc_named_const(NULL, 1, "paging_request"); - if (paging_pending_request(bts_entry, subscr)) { DEBUGP(DPAG, "Paging request already pending\n"); return; @@ -310,3 +307,8 @@ void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t free_slots) { bts->paging.available_slots = free_slots; } + +static __attribute__((constructor)) void on_dso_load_paging(void) +{ + tall_paging_ctx = talloc_named_const(NULL, 1, "paging_request"); +} -- cgit v1.2.3