Change in osmo-bsc[master]: Move a_reset_fsm regstration to __attribute__((contructor))

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

laforge gerrit-no-reply at lists.osmocom.org
Sun Dec 1 20:01:20 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/16384 )

Change subject: Move a_reset_fsm regstration to __attribute__((contructor))
......................................................................

Move a_reset_fsm regstration to __attribute__((contructor))

This way we can avoid the runtime overhead of checking whether or not
it is initialized over and over again.  It also brings this code more
in line with other users of osmo_fsm_register().

Change-Id: I3c7220491cf6ffb1361e7259c0344df64a013a0a
---
M src/osmo-bsc/a_reset.c
1 file changed, 5 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/src/osmo-bsc/a_reset.c b/src/osmo-bsc/a_reset.c
index bc41914..3f51278 100644
--- a/src/osmo-bsc/a_reset.c
+++ b/src/osmo-bsc/a_reset.c
@@ -149,10 +149,6 @@
 	/* There must not be any double allocation! */
 	OSMO_ASSERT(msc->a.reset_fsm == NULL);
 
-	/* Register the fsm description (if not already done) */
-	if (osmo_fsm_find_by_name(fsm.name) != &fsm)
-		OSMO_ASSERT(osmo_fsm_register(&fsm) == 0);
-
 	/* Allocate and configure a new fsm instance */
 	reset_ctx = talloc_zero(msc, struct reset_ctx);
 	OSMO_ASSERT(reset_ctx);
@@ -217,3 +213,8 @@
 
 	return false;
 }
+
+static __attribute__((constructor)) void a_reset_fsm_init()
+{
+	OSMO_ASSERT(osmo_fsm_register(&fsm) == 0);
+}

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I3c7220491cf6ffb1361e7259c0344df64a013a0a
Gerrit-Change-Number: 16384
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191201/ee2197ac/attachment.htm>


More information about the gerrit-log mailing list