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.
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 642d059..a9f2ebd 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -350,9 +350,6 @@
use_lchan(lchan);
release_loc_updating_req(lchan);
- if (!tall_locop_ctx)
- tall_locop_ctx = talloc_named_const(tall_bsc_ctx, 1,
- "loc_updating_oper");
lchan->loc_operation = talloc_zero(tall_locop_ctx,
struct gsm_loc_updating_operation);
}
@@ -408,6 +405,8 @@
*/
static __attribute__((constructor)) void on_dso_load_0408(void)
{
+ tall_locop_ctx = talloc_named_const(tall_bsc_ctx, 1,
+ "loc_updating_oper");
register_signal_handler(SS_LCHAN, gsm0408_handle_lchan_signal, NULL);
}