<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Not sure we really need this API</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Actually you're right. This came up while hacking on stats_test.c, while most real world callers actually have a osmo_stat_item_group pointer at hand already, e.g.</p><p style="white-space: pre-wrap; word-wrap: break-word;">osmo-bsc/src/osmo-bsc/bts.c:817:     osmo_stat_item_set(osmo_stat_item_group_get_item(bts->bts_statg, BTS_STAT_CHAN_OSMO_DYN_TOTAL), 0);</p><p style="white-space: pre-wrap; word-wrap: break-word;">This here is an example of the actual use I was aiming to make nicer.<br>Would you agree that it would look better as:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> osmo_stat_item_set2(bts->bts_statg, BTS_STAT_CHAN_OSMO_DYN_TOTAL, 0);</pre><p style="white-space: pre-wrap; word-wrap: break-word;">?</p><p style="white-space: pre-wrap; word-wrap: break-word;">OT now, but your con mentioning optimization is not valid IMO, because it is speculating on callers and is only about an O(n) algorithm. Your con about no-one besides stats_test.c using this function is indeed valid. I think I might put it static in stats_test.c or not bother at all.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/25463">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/25463">change 25463</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/+/25463"/><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: I58886ae8af6b1f770088410f63d27ac21bf979fb </div>
<div style="display:none"> Gerrit-Change-Number: 25463 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Wed, 15 Sep 2021 17:56:25 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>