<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/26235">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">rate_ctr: Make it safe to call rate_ctr_init() several times<br><br>There might be library code that has rate counters, and if the main<br>program calls rate_ctr_init() a second time, we can skip the second<br>initialization.<br><br>Change-Id: I6f5342a77518599eb5ac9a0f0605917a78fcc387<br>---<br>M src/rate_ctr.c<br>1 file changed, 4 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/35/26235/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/rate_ctr.c b/src/rate_ctr.c</span><br><span>index 4d99699..283858d 100644</span><br><span>--- a/src/rate_ctr.c</span><br><span>+++ b/src/rate_ctr.c</span><br><span>@@ -354,6 +354,10 @@</span><br><span>  *  \returns 0 on success; negative on error */</span><br><span> int rate_ctr_init(void *tall_ctx)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+   /* ignore repeated initialization */</span><br><span style="color: hsl(120, 100%, 40%);">+  if (osmo_timer_pending(&rate_ctr_timer))</span><br><span style="color: hsl(120, 100%, 40%);">+          return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  tall_rate_ctr_ctx = tall_ctx;</span><br><span>        osmo_timer_setup(&rate_ctr_timer, rate_ctr_timer_cb, NULL);</span><br><span>      osmo_timer_schedule(&rate_ctr_timer, 1, 0);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/26235">change 26235</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/libosmocore/+/26235"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I6f5342a77518599eb5ac9a0f0605917a78fcc387 </div>
<div style="display:none"> Gerrit-Change-Number: 26235 </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>