Move ts_fsm_init to static constructor [3/4]

This allows having it initialized automatically, as we usually do with
this type of code. As a result, tests or other apps importing libbsc
don't need to take care of calling it.

NOTE: This fix is required by follow-up patches where some stubs are removed
and hence some tests start using FSMs internally. Since tests were not
using those FSMs before, there was no need to call ts_fsm_init().

This is one further step towards fixing interdependency mess of symbols
and stubs.

Change-Id: I0e4b95b5e73fbb3844d83ba33e66786831088e1f
This commit is contained in:
Pau Espin 2021-10-05 19:23:27 +02:00
parent 12adbeaba3
commit 40c7410f9e
4 changed files with 1 additions and 5 deletions

View File

@ -42,8 +42,6 @@ enum ts_fsm_event {
TS_EV_PDCH_DEACT_NACK,
};
void ts_fsm_init();
void ts_fsm_alloc(struct gsm_bts_trx_ts *ts);
void ts_fsm_free(struct gsm_bts_trx_ts *ts);

View File

@ -979,7 +979,6 @@ int main(int argc, char **argv)
/* seed the PRNG */
srand(time(NULL));
ts_fsm_init();
lchan_fsm_init();
bsc_subscr_conn_fsm_init();
assignment_fsm_init();

View File

@ -52,7 +52,7 @@ static void ts_fsm_update_id(struct gsm_bts_trx_ts *ts)
gsm_pchan_id(ts->pchan_on_init));
}
void ts_fsm_init()
static __attribute__((constructor)) void ts_fsm_init(void)
{
OSMO_ASSERT(osmo_fsm_register(&ts_fsm) == 0);
}

View File

@ -1626,7 +1626,6 @@ int main(int argc, char **argv)
bsc_vty_init(bsc_gsmnet);
ho_test_vty_init();
ts_fsm_init();
lchan_fsm_init();
bsc_subscr_conn_fsm_init();
handover_fsm_init();