diff options
author | Harald Welte <laforge@gnumonks.org> | 2009-07-28 00:41:45 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2009-07-28 00:41:45 +0200 |
commit | 7bfc26749662e3a3227037cce4a24748343b50be (patch) | |
tree | 2bd0ad79d43b2e72407792d30cac97e5fb8f825d /openbsc/src/mncc.c | |
parent | b49248bf48b0856e3b156810681ea3fca44c728a (diff) |
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.
Diffstat (limited to 'openbsc/src/mncc.c')
-rw-r--r-- | openbsc/src/mncc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/openbsc/src/mncc.c b/openbsc/src/mncc.c index b2dab078e..8cd62f6ce 100644 --- a/openbsc/src/mncc.c +++ b/openbsc/src/mncc.c @@ -140,9 +140,6 @@ static int mncc_setup_ind(struct gsm_call *call, int msg_type, if (call->remote_ref) return 0; - if (!tall_call_ctx) - tall_call_ctx = talloc_named_const(tall_bsc_ctx, 1, - "gsm_call"); /* create remote call */ if (!(remote = talloc(tall_call_ctx, struct gsm_call))) { memset(&mncc, 0, sizeof(struct gsm_mncc)); @@ -306,9 +303,6 @@ int mncc_recv(struct gsm_network *net, int msg_type, void *arg) if (!call) { if (msg_type != MNCC_SETUP_IND) return 0; /* drop */ - if (!tall_call_ctx) - tall_call_ctx = talloc_named_const(tall_bsc_ctx, 1, - "gsm_call"); /* create call */ if (!(call = talloc_zero(tall_call_ctx, struct gsm_call))) { struct gsm_mncc rel; @@ -395,3 +389,8 @@ int mncc_recv(struct gsm_network *net, int msg_type, void *arg) return rc; } + +static __attribute__((constructor)) void on_dso_load_trau_mncc(void) +{ + tall_call_ctx = talloc_named_const(tall_bsc_ctx, 1, "gsm_call"); +} |