Change in osmo-sgsn[master]: gtphub: remove llist_first, llist_last macros

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Mon Jul 12 12:06:06 UTC 2021


osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/24914 )

Change subject: gtphub: remove llist_first, llist_last macros
......................................................................

gtphub: remove llist_first, llist_last macros

Use list_first_entry_or_null instead of llist_first, which has been
present in libosmocore since the 0.10.0 release.

Use llist_last_entry instead of llist_last (also present since
libosmocore 0.10.0). This macro does not have a check for an empty
list, however the only user is already checking for an empty list
before using the macro.

This solves a build error, as llist_last was defined in libosmocore
Icf455bf6ba9d60bd311af17c9e80febaa42cacc9 (should probably be reverted
for backwards compatibility with previous osmo-sgsn versions?):

gtphub.c:68:0: error: "llist_last" redefined [-Werror]
 #define llist_last(head, type, entry) \

In file included from /build/deps/install/stow/libosmocore/include/osmocom/core/timer.h:46:0,
                 from /build/deps/install/stow/osmo-ggsn/include/gtp.h:17,
                 from gtphub.c:32:
/build/deps/install/stow/libosmocore/include/osmocom/core/linuxlist.h:245:0: note: this is the location of the previous definition
 #define llist_last(head) (head)->prev

Change-Id: Ia0496c24386cd13b1e9e604aa2d425d3fa28d352
---
M src/gtphub/gtphub.c
1 file changed, 2 insertions(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  daniel: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved



diff --git a/src/gtphub/gtphub.c b/src/gtphub/gtphub.c
index 237d699..09d01fc 100644
--- a/src/gtphub/gtphub.c
+++ b/src/gtphub/gtphub.c
@@ -59,15 +59,6 @@
 /* TODO move this to osmocom/core/select.h ? */
 typedef int (*osmo_fd_cb_t)(struct osmo_fd *fd, unsigned int what);
 
-/* TODO move this to osmocom/core/linuxlist.h ? */
-#define __llist_first(head) (((head)->next == (head)) ? NULL : (head)->next)
-#define llist_first(head, type, entry) \
-	llist_entry(__llist_first(head), type, entry)
-
-#define __llist_last(head) (((head)->next == (head)) ? NULL : (head)->prev)
-#define llist_last(head, type, entry) \
-	llist_entry(__llist_last(head), type, entry)
-
 /* TODO move GTP header stuff to openggsn/gtp/ ? See gtp_decaps*() */
 
 enum gtp_rc {
@@ -613,7 +604,7 @@
 
 	OSMO_ASSERT(llist_empty(&exq->items)
 		    || (item->expiry
-			>= llist_last(&exq->items, struct expiring_item, entry)->expiry));
+			>= llist_last_entry(&exq->items, struct expiring_item, entry)->expiry));
 
 	/* Add/move to the tail to always sort by expiry, ascending. */
 	llist_del(&item->entry);
@@ -1142,9 +1133,7 @@
 	if (llist_empty(&peer->addresses))
 		return "(addressless)";
 
-	struct gtphub_peer_addr *a = llist_first(&peer->addresses,
-						 struct gtphub_peer_addr,
-						 entry);
+	struct gtphub_peer_addr *a = llist_first_entry_or_null(&peer->addresses, struct gtphub_peer_addr, entry);
 	return gsn_addr_to_strb(&a->addr, buf, buflen);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/24914
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0496c24386cd13b1e9e604aa2d425d3fa28d352
Gerrit-Change-Number: 24914
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210712/b65fffdd/attachment.htm>


More information about the gerrit-log mailing list