<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/16384">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Move a_reset_fsm regstration to __attribute__((contructor))<br><br>This way we can avoid the runtime overhead of checking whether or not<br>it is initialized over and over again.  It also brings this code more<br>in line with other users of osmo_fsm_register().<br><br>Change-Id: I3c7220491cf6ffb1361e7259c0344df64a013a0a<br>---<br>M src/osmo-bsc/a_reset.c<br>1 file changed, 5 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/84/16384/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/a_reset.c b/src/osmo-bsc/a_reset.c</span><br><span>index bc41914..3f51278 100644</span><br><span>--- a/src/osmo-bsc/a_reset.c</span><br><span>+++ b/src/osmo-bsc/a_reset.c</span><br><span>@@ -149,10 +149,6 @@</span><br><span>         /* There must not be any double allocation! */</span><br><span>       OSMO_ASSERT(msc->a.reset_fsm == NULL);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   /* Register the fsm description (if not already done) */</span><br><span style="color: hsl(0, 100%, 40%);">-        if (osmo_fsm_find_by_name(fsm.name) != &fsm)</span><br><span style="color: hsl(0, 100%, 40%);">-                OSMO_ASSERT(osmo_fsm_register(&fsm) == 0);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>       /* Allocate and configure a new fsm instance */</span><br><span>      reset_ctx = talloc_zero(msc, struct reset_ctx);</span><br><span>      OSMO_ASSERT(reset_ctx);</span><br><span>@@ -217,3 +213,8 @@</span><br><span> </span><br><span>    return false;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static __attribute__((constructor)) void a_reset_fsm_init()</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  OSMO_ASSERT(osmo_fsm_register(&fsm) == 0);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/16384">change 16384</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/16384"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I3c7220491cf6ffb1361e7259c0344df64a013a0a </div>
<div style="display:none"> Gerrit-Change-Number: 16384 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>