<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/23297">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gsm0808_utils: add gsm0808_cell_id_lists_same()<br><br>Change-Id: I16bc903f9c5820ad00d588e59a4a6923d1f3f542<br>---<br>M include/osmocom/gsm/gsm0808_utils.h<br>M src/gsm/gsm0808_utils.c<br>M src/gsm/libosmogsm.map<br>3 files changed, 25 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/97/23297/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h</span><br><span>index 76e9064..53e22f9 100644</span><br><span>--- a/include/osmocom/gsm/gsm0808_utils.h</span><br><span>+++ b/include/osmocom/gsm/gsm0808_utils.h</span><br><span>@@ -91,6 +91,7 @@</span><br><span> bool gsm0808_cell_ids_match(const struct gsm0808_cell_id *id1, const struct gsm0808_cell_id *id2, bool exact_match);</span><br><span> int gsm0808_cell_id_matches_list(const struct gsm0808_cell_id *id, const struct gsm0808_cell_id_list2 *list,</span><br><span>                               unsigned int match_nr, bool exact_match);</span><br><span style="color: hsl(120, 100%, 40%);">+bool gsm0808_cell_id_lists_same(const struct gsm0808_cell_id_list2 *a, const struct gsm0808_cell_id_list2 *b);</span><br><span> void gsm0808_cell_id_from_cgi(struct gsm0808_cell_id *cid, enum CELL_IDENT id_discr,</span><br><span>                         const struct osmo_cell_global_id *cgi);</span><br><span> int gsm0808_cell_id_to_cgi(struct osmo_cell_global_id *cgi, const struct gsm0808_cell_id *cid);</span><br><span>diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c</span><br><span>index dda73ad..7d7934a 100644</span><br><span>--- a/src/gsm/gsm0808_utils.c</span><br><span>+++ b/src/gsm/gsm0808_utils.c</span><br><span>@@ -1787,6 +1787,29 @@</span><br><span>   return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*! Determine whether two cell id lists are exactly identical, in ordering, id_discr and values.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] a  Cell ID list to compare.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] b  Other cell ID list to compare.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \returns true when both lists are identical.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+bool gsm0808_cell_id_lists_same(const struct gsm0808_cell_id_list2 *a, const struct gsm0808_cell_id_list2 *b)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     int i;</span><br><span style="color: hsl(120, 100%, 40%);">+        if (a == b)</span><br><span style="color: hsl(120, 100%, 40%);">+           return true;</span><br><span style="color: hsl(120, 100%, 40%);">+  if (a->id_list_len != b->id_list_len)</span><br><span style="color: hsl(120, 100%, 40%);">+           return false;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (a->id_discr != b->id_discr)</span><br><span style="color: hsl(120, 100%, 40%);">+         return false;</span><br><span style="color: hsl(120, 100%, 40%);">+ for (i = 0; i < a->id_list_len; i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+          if (!gsm0808_cell_id_u_match(a->id_discr, &a->id_list[i],</span><br><span style="color: hsl(120, 100%, 40%);">+                                        b->id_discr, &b->id_list[i],</span><br><span style="color: hsl(120, 100%, 40%);">+                                        true))</span><br><span style="color: hsl(120, 100%, 40%);">+                   return false;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+     return true;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! Copy information from a CGI to form a Cell Identifier of the specified kind.</span><br><span>  * \param [out] cid  Compose new Cell Identifier here.</span><br><span>  * \param [in] id_discr  Which kind of Cell Identifier to compose.</span><br><span>diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map</span><br><span>index 0ea0678..f43713a 100644</span><br><span>--- a/src/gsm/libosmogsm.map</span><br><span>+++ b/src/gsm/libosmogsm.map</span><br><span>@@ -238,6 +238,7 @@</span><br><span> gsm0808_cell_id_u_name;</span><br><span> gsm0808_cell_ids_match;</span><br><span> gsm0808_cell_id_matches_list;</span><br><span style="color: hsl(120, 100%, 40%);">+gsm0808_cell_id_lists_same;</span><br><span> gsm0808_chan_type_to_speech_codec;</span><br><span> gsm0808_speech_codec_from_chan_type;</span><br><span> gsm0808_sc_cfg_from_gsm48_mr_cfg;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/23297">change 23297</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/+/23297"/><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: I16bc903f9c5820ad00d588e59a4a6923d1f3f542 </div>
<div style="display:none"> Gerrit-Change-Number: 23297 </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-MessageType: newchange </div>