Change in osmo-remsim[master]: move osmo_fsm_register() into constructor function

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Mar 7 17:34:59 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13104 )

Change subject: move osmo_fsm_register() into constructor function
......................................................................

move osmo_fsm_register() into constructor function

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

Change-Id: I20753d7f7f485e7e495b64fa74b24858cd22ffa9
---
M src/remsim_client.c
M src/remsim_client_fsm.c
M src/simtrace2-remsim_client.c
3 files changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/remsim_client.c b/src/remsim_client.c
index b60059d..62f65f9 100644
--- a/src/remsim_client.c
+++ b/src/remsim_client.c
@@ -88,9 +88,6 @@
 {
 	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;
diff --git a/src/remsim_client_fsm.c b/src/remsim_client_fsm.c
index 0776937..d361659 100644
--- a/src/remsim_client_fsm.c
+++ b/src/remsim_client_fsm.c
@@ -464,3 +464,9 @@
 	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);
+}
diff --git a/src/simtrace2-remsim_client.c b/src/simtrace2-remsim_client.c
index 1cf09a6..6d31d32 100644
--- a/src/simtrace2-remsim_client.c
+++ b/src/simtrace2-remsim_client.c
@@ -749,9 +749,6 @@
 	// 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;

-- 
To view, visit https://gerrit.osmocom.org/13104
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I20753d7f7f485e7e495b64fa74b24858cd22ffa9
Gerrit-Change-Number: 13104
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190307/0741aea0/attachment.htm>


More information about the gerrit-log mailing list