aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/abis_nm.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-07-28 00:41:45 +0200
committerHarald Welte <laforge@gnumonks.org>2009-07-28 00:41:45 +0200
commit7bfc26749662e3a3227037cce4a24748343b50be (patch)
tree2bd0ad79d43b2e72407792d30cac97e5fb8f825d /openbsc/src/abis_nm.c
parentb49248bf48b0856e3b156810681ea3fca44c728a (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/abis_nm.c')
-rw-r--r--openbsc/src/abis_nm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index 2b5647962..dec4b2957 100644
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -2056,10 +2056,6 @@ static int bs11_read_swl_file(struct abis_nm_bs11_sw *bs11_sw)
FILE *swl;
int rc = 0;
- if (!tall_fle_ctx)
- tall_fle_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "bs11_file_list_entry");
-
swl = fopen(bs11_sw->swl_fname, "r");
if (!swl)
return -ENODEV;
@@ -2373,3 +2369,10 @@ int abis_nm_ipaccess_restart(struct gsm_bts *bts)
{
return __simple_cmd(bts, NM_MT_IPACC_RESTART);
}
+
+
+static __attribute__((constructor)) void on_dso_load_abis_nm(void)
+{
+ tall_fle_ctx = talloc_named_const(tall_bsc_ctx, 1,
+ "bs11_file_list_entry");
+}