Change in osmo-bsc[master]: Move ts_fsm_init to static constructor

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/.

pespin gerrit-no-reply at lists.osmocom.org
Thu Oct 7 11:14:03 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/25708 )


Change subject: Move ts_fsm_init to static constructor
......................................................................

Move ts_fsm_init to static constructor

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.

Change-Id: I0e4b95b5e73fbb3844d83ba33e66786831088e1f
---
M include/osmocom/bsc/timeslot_fsm.h
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc/timeslot_fsm.c
M tests/handover/handover_test.c
4 files changed, 1 insertion(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/08/25708/1

diff --git a/include/osmocom/bsc/timeslot_fsm.h b/include/osmocom/bsc/timeslot_fsm.h
index 1831537..5e62188 100644
--- a/include/osmocom/bsc/timeslot_fsm.h
+++ b/include/osmocom/bsc/timeslot_fsm.h
@@ -42,8 +42,6 @@
         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);
 
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 8d6901d..e8a22fe 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -979,7 +979,6 @@
 	/* seed the PRNG */
 	srand(time(NULL));
 
-	ts_fsm_init();
 	lchan_fsm_init();
 	bsc_subscr_conn_fsm_init();
 	assignment_fsm_init();
diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c
index 8d256bb..76ac1af 100644
--- a/src/osmo-bsc/timeslot_fsm.c
+++ b/src/osmo-bsc/timeslot_fsm.c
@@ -52,7 +52,7 @@
 				  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);
 }
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index bd65b2f..1dc7c1f 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -1626,7 +1626,6 @@
 	bsc_vty_init(bsc_gsmnet);
 	ho_test_vty_init();
 
-	ts_fsm_init();
 	lchan_fsm_init();
 	bsc_subscr_conn_fsm_init();
 	handover_fsm_init();

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/25708
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I0e4b95b5e73fbb3844d83ba33e66786831088e1f
Gerrit-Change-Number: 25708
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211007/270f6453/attachment.htm>


More information about the gerrit-log mailing list