aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2019-12-01 15:43:40 +0100
committerHarald Welte <laforge@osmocom.org>2019-12-01 15:43:40 +0100
commit5e4fdb23a48fa9990e739d39296289403ce8cbe0 (patch)
treea27fb99bbdaaaa6eaf0973eaf94a79240dc5b326 /src/osmo-bsc
parent16c8910c71ac2524b92cbb6152efef40bc36e1b6 (diff)
Move a_reset_fsm regstration to __attribute__((contructor))
This way we can avoid the runtime overhead of checking whether or not it is initialized over and over again. It also brings this code more in line with other users of osmo_fsm_register(). Change-Id: I3c7220491cf6ffb1361e7259c0344df64a013a0a
Diffstat (limited to 'src/osmo-bsc')
-rw-r--r--src/osmo-bsc/a_reset.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/osmo-bsc/a_reset.c b/src/osmo-bsc/a_reset.c
index bc4191456..3f512781b 100644
--- a/src/osmo-bsc/a_reset.c
+++ b/src/osmo-bsc/a_reset.c
@@ -149,10 +149,6 @@ void a_reset_alloc(struct bsc_msc_data *msc, const char *name, void *cb)
/* There must not be any double allocation! */
OSMO_ASSERT(msc->a.reset_fsm == NULL);
- /* Register the fsm description (if not already done) */
- if (osmo_fsm_find_by_name(fsm.name) != &fsm)
- OSMO_ASSERT(osmo_fsm_register(&fsm) == 0);
-
/* Allocate and configure a new fsm instance */
reset_ctx = talloc_zero(msc, struct reset_ctx);
OSMO_ASSERT(reset_ctx);
@@ -217,3 +213,8 @@ bool a_reset_conn_ready(struct bsc_msc_data *msc)
return false;
}
+
+static __attribute__((constructor)) void a_reset_fsm_init()
+{
+ OSMO_ASSERT(osmo_fsm_register(&fsm) == 0);
+}