<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/12410">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Vadim Yanitskiy: Looks good to me, approved
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">GSUP: add end marker to enum osmo_gsup_iei<br><br>Simplify gsup_test.c by defining an end marker in gsup.h. No need to<br>manually update the last element every time anymore.<br><br>The C standard guarantees, that the end marker will have the last value<br>plus one: "Each subsequent enumerator with no = defines its enumeration<br>constant as the value of the constant expression obtained by adding 1 to<br>the value of the previous enumeration constant." (From C99: 6.7.2.2<br>Enumeration specifiers)<br><br>Change-Id: I2aab7245e209f0ebd2f33a83d4d181dd3339cb17<br>---<br>M include/osmocom/gsm/gsup.h<br>M tests/gsup/gsup_test.c<br>2 files changed, 3 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h</span><br><span>index 51871e4..37e474c 100644</span><br><span>--- a/include/osmocom/gsm/gsup.h</span><br><span>+++ b/include/osmocom/gsm/gsup.h</span><br><span>@@ -98,6 +98,8 @@</span><br><span>      OSMO_GSUP_SM_RP_CAUSE_IE                = 0x44,</span><br><span>      OSMO_GSUP_SM_RP_MMS_IE                  = 0x45,</span><br><span>      OSMO_GSUP_SM_ALERT_RSN_IE               = 0x46,</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     _OSMO_GSUP_IEI_END_MARKER</span><br><span> };</span><br><span> </span><br><span> /*! GSUP message type */</span><br><span>diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c</span><br><span>index b3a8c77..079a703 100644</span><br><span>--- a/tests/gsup/gsup_test.c</span><br><span>+++ b/tests/gsup/gsup_test.c</span><br><span>@@ -401,11 +401,7 @@</span><br><span>                                  osmo_hexdump(t->data + j, ie_end - j));</span><br><span> </span><br><span>                               OSMO_ASSERT(j <= ie_end - 2);</span><br><span style="color: hsl(0, 100%, 40%);">-                                /**</span><br><span style="color: hsl(0, 100%, 40%);">-                              * FIXME: share the maximal IE value somehow</span><br><span style="color: hsl(0, 100%, 40%);">-                             * in order to avoid manual updating of this</span><br><span style="color: hsl(0, 100%, 40%);">-                             */</span><br><span style="color: hsl(0, 100%, 40%);">-                             OSMO_ASSERT(t->data[j+0] <= OSMO_GSUP_SM_ALERT_RSN_IE);</span><br><span style="color: hsl(120, 100%, 40%);">+                         OSMO_ASSERT(t->data[j+0] < _OSMO_GSUP_IEI_END_MARKER);</span><br><span>                                 OSMO_ASSERT(t->data[j+1] <= ie_end - j - 2);</span><br><span> </span><br><span>                               ie_end = j;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/12410">change 12410</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/12410"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I2aab7245e209f0ebd2f33a83d4d181dd3339cb17 </div>
<div style="display:none"> Gerrit-Change-Number: 12410 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Vadim Yanitskiy <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>