<p>osmith has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-sgsn/+/24914">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gtphub: remove llist_first, llist_last macros<br><br>Use list_first_entry_or_null instead of llist_first, which has been<br>present in libosmocore since the 0.10.0 release.<br><br>Use llist_last_entry instead of llist_last (also present since<br>libosmocore 0.10.0). This macro does not have a check for an empty<br>list, however the only user is already checking for an empty list<br>before using the macro.<br><br>This solves a build error, as llist_last was defined in libosmocore<br>Icf455bf6ba9d60bd311af17c9e80febaa42cacc9 (should probably be reverted<br>for backwards compatibility with previous osmo-sgsn versions?):<br><br>gtphub.c:68:0: error: "llist_last" redefined [-Werror]<br> #define llist_last(head, type, entry) \<br><br>In file included from /build/deps/install/stow/libosmocore/include/osmocom/core/timer.h:46:0,<br>                 from /build/deps/install/stow/osmo-ggsn/include/gtp.h:17,<br>                 from gtphub.c:32:<br>/build/deps/install/stow/libosmocore/include/osmocom/core/linuxlist.h:245:0: note: this is the location of the previous definition<br> #define llist_last(head) (head)->prev<br><br>Change-Id: Ia0496c24386cd13b1e9e604aa2d425d3fa28d352<br>---<br>M src/gtphub/gtphub.c<br>1 file changed, 2 insertions(+), 13 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/14/24914/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gtphub/gtphub.c b/src/gtphub/gtphub.c</span><br><span>index 237d699..09d01fc 100644</span><br><span>--- a/src/gtphub/gtphub.c</span><br><span>+++ b/src/gtphub/gtphub.c</span><br><span>@@ -59,15 +59,6 @@</span><br><span> /* TODO move this to osmocom/core/select.h ? */</span><br><span> typedef int (*osmo_fd_cb_t)(struct osmo_fd *fd, unsigned int what);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/* TODO move this to osmocom/core/linuxlist.h ? */</span><br><span style="color: hsl(0, 100%, 40%);">-#define __llist_first(head) (((head)->next == (head)) ? NULL : (head)->next)</span><br><span style="color: hsl(0, 100%, 40%);">-#define llist_first(head, type, entry) \</span><br><span style="color: hsl(0, 100%, 40%);">-        llist_entry(__llist_first(head), type, entry)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#define __llist_last(head) (((head)->next == (head)) ? NULL : (head)->prev)</span><br><span style="color: hsl(0, 100%, 40%);">-#define llist_last(head, type, entry) \</span><br><span style="color: hsl(0, 100%, 40%);">-   llist_entry(__llist_last(head), type, entry)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /* TODO move GTP header stuff to openggsn/gtp/ ? See gtp_decaps*() */</span><br><span> </span><br><span> enum gtp_rc {</span><br><span>@@ -613,7 +604,7 @@</span><br><span> </span><br><span>         OSMO_ASSERT(llist_empty(&exq->items)</span><br><span>              || (item->expiry</span><br><span style="color: hsl(0, 100%, 40%);">-                 >= llist_last(&exq->items, struct expiring_item, entry)->expiry));</span><br><span style="color: hsl(120, 100%, 40%);">+                       >= llist_last_entry(&exq->items, struct expiring_item, entry)->expiry));</span><br><span> </span><br><span>    /* Add/move to the tail to always sort by expiry, ascending. */</span><br><span>      llist_del(&item->entry);</span><br><span>@@ -1142,9 +1133,7 @@</span><br><span>      if (llist_empty(&peer->addresses))</span><br><span>            return "(addressless)";</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   struct gtphub_peer_addr *a = llist_first(&peer->addresses,</span><br><span style="color: hsl(0, 100%, 40%);">-                                                struct gtphub_peer_addr,</span><br><span style="color: hsl(0, 100%, 40%);">-                                                entry);</span><br><span style="color: hsl(120, 100%, 40%);">+      struct gtphub_peer_addr *a = llist_first_entry_or_null(&peer->addresses, struct gtphub_peer_addr, entry);</span><br><span>     return gsn_addr_to_strb(&a->addr, buf, buflen);</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-sgsn/+/24914">change 24914</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-sgsn/+/24914"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-sgsn </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ia0496c24386cd13b1e9e604aa2d425d3fa28d352 </div>
<div style="display:none"> Gerrit-Change-Number: 24914 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>