lynxis lazus has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmocore/+/29792 )
Change subject: linuxlist: add llist_entry_empty()
......................................................................
linuxlist: add llist_entry_empty()
Return true if an entry is not included in a llist or
NULL.
Change-Id: Ia4afe3e77f53728db1d139bded5925183dca011f
---
M include/osmocom/core/linuxlist.h
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/92/29792/1
diff --git a/include/osmocom/core/linuxlist.h b/include/osmocom/core/linuxlist.h
index 2fc3fa7..398128d 100644
--- a/include/osmocom/core/linuxlist.h
+++ b/include/osmocom/core/linuxlist.h
@@ -171,6 +171,17 @@
return head->next == head;
}
+/*!
+ * Test whether a linked list entry is empty or not included by any list.
+ * \param[in] entry the llist to test
+ * \return 1 if the entry is NULL or not included by any llist.
+ */
+static inline int llist_entry_empty(const struct llist_head *entry)
+{
+ return entry == NULL || (!entry->next && !entry->prev)
+ || (entry->next == LLIST_POISON1 && entry->prev == LLIST_POISON2);
+}
+
static inline void __llist_splice(struct llist_head *llist,
struct llist_head *head)
{
--
To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/29792
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia4afe3e77f53728db1d139bded5925183dca011f
Gerrit-Change-Number: 29792
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-MessageType: newchange