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/e1_input.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/e1_input.c')
-rw-r--r-- | openbsc/src/e1_input.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/openbsc/src/e1_input.c b/openbsc/src/e1_input.c index 2d0c1340f..7531755c2 100644 --- a/openbsc/src/e1_input.c +++ b/openbsc/src/e1_input.c @@ -370,10 +370,6 @@ e1inp_sign_link_create(struct e1inp_ts *ts, enum e1inp_sign_type type, if (ts->type != E1INP_TS_TYPE_SIGN) return NULL; - if (!tall_sigl_ctx) - tall_sigl_ctx = talloc_named_const(tall_bsc_ctx, 1, - "e1inp_sign_link"); - link = talloc_zero(tall_sigl_ctx, struct e1inp_sign_link); if (!link) return NULL; @@ -505,3 +501,9 @@ int e1inp_line_register(struct e1inp_line *line) return 0; } + +static __attribute__((constructor)) void on_dso_load_e1_inp(void) +{ + tall_sigl_ctx = talloc_named_const(tall_bsc_ctx, 1, + "e1inp_sign_link"); +} |