[PATCH] openbsc[master]: cosmetic: prepare for llist_first/_last in libosmocore

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Feb 15 00:17:09 UTC 2017


Review at  https://gerrit.osmocom.org/1824

cosmetic: prepare for llist_first/_last in libosmocore

I would like to move the llist_first and llist_last macros from gtphub.c to
libosmocore with change-id I296b7cf1c7cb07b24c2e17084b03fed321c53a7c. To avoid
compiler warnings, encapsulate the gtphub.c definitions in an #ifndef.

Change-Id: I8afaad471eb38d897184ea53cb1f4d10850e35eb
---
M openbsc/src/gprs/gtphub.c
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/24/1824/1

diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c
index a1aaed2..03aca74 100644
--- a/openbsc/src/gprs/gtphub.c
+++ b/openbsc/src/gprs/gtphub.c
@@ -58,6 +58,7 @@
 typedef int (*osmo_fd_cb_t)(struct osmo_fd *fd, unsigned int what);
 
 /* TODO move this to osmocom/core/linuxlist.h ? */
+#ifndef __llist_first
 #define __llist_first(head) (((head)->next == (head)) ? NULL : (head)->next)
 #define llist_first(head, type, entry) \
 	llist_entry(__llist_first(head), type, entry)
@@ -65,6 +66,7 @@
 #define __llist_last(head) (((head)->next == (head)) ? NULL : (head)->prev)
 #define llist_last(head, type, entry) \
 	llist_entry(__llist_last(head), type, entry)
+#endif
 
 /* TODO move GTP header stuff to openggsn/gtp/ ? See gtp_decaps*() */
 
@@ -611,7 +613,7 @@
 
 	OSMO_ASSERT(llist_empty(&exq->items)
 		    || (item->expiry
-			>= llist_last(&exq->items, struct expiring_item, entry)->expiry));
+			>= _llist_last(&exq->items, struct expiring_item, entry)->expiry));
 
 	/* Add/move to the tail to always sort by expiry, ascending. */
 	llist_del(&item->entry);
@@ -1133,7 +1135,7 @@
 	if (llist_empty(&peer->addresses))
 		return "(addressless)";
 
-	struct gtphub_peer_addr *a = llist_first(&peer->addresses,
+	struct gtphub_peer_addr *a = _llist_first(&peer->addresses,
 						 struct gtphub_peer_addr,
 						 entry);
 	return gsn_addr_to_strb(&a->addr, buf, buflen);

-- 
To view, visit https://gerrit.osmocom.org/1824
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8afaad471eb38d897184ea53cb1f4d10850e35eb
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list