move osmo_fsm_register() into constructor function

This way each application doesn't have to explicitly call it.

Change-Id: I20753d7f7f485e7e495b64fa74b24858cd22ffa9
This commit is contained in:
Harald Welte 2019-03-02 12:55:59 +01:00
parent 3ac66a1bb7
commit 7fc64bc5b2
3 changed files with 6 additions and 6 deletions

View File

@ -88,9 +88,6 @@ int main(int argc, char **argv)
{
g_tall_ctx = talloc_named_const(NULL, 0, "global");
osmo_fsm_register(&remsim_client_bankd_fsm);
osmo_fsm_register(&remsim_client_server_fsm);
g_client = talloc_zero(g_tall_ctx, struct bankd_client);
g_client->bankd_host = "localhost";
g_client->bankd_port = 9999;

View File

@ -464,3 +464,9 @@ int server_conn_fsm_alloc(void *ctx, struct rspro_server_conn *srvc)
srvc_st_init_onenter(fi, 0);
return 0;
}
static __attribute__((constructor)) void on_dso_load(void)
{
osmo_fsm_register(&remsim_client_bankd_fsm);
osmo_fsm_register(&remsim_client_server_fsm);
}

View File

@ -749,9 +749,6 @@ int main(int argc, char **argv)
// initialize remote SIM client
g_tall_ctx = talloc_named_const(NULL, 0, "global");
osmo_fsm_register(&remsim_client_bankd_fsm);
osmo_fsm_register(&remsim_client_server_fsm);
g_client = talloc_zero(g_tall_ctx, struct bankd_client);
g_client->bankd_host = bankd_host;
g_client->bankd_port = bankd_port;