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

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Mar 3 21:01:43 UTC 2019


Harald Welte has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/04/13104/1

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: newchange
Gerrit-Change-Id: I20753d7f7f485e7e495b64fa74b24858cd22ffa9
Gerrit-Change-Number: 13104
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190303/d8643860/attachment.html>


More information about the gerrit-log mailing list