Change in libosmocore[master]: linuxlist: add function to check entry presence

dexter gerrit-no-reply at
Wed Jun 30 15:10:57 UTC 2021

dexter has uploaded this change for review. ( )

Change subject: linuxlist: add function to check entry presence

linuxlist: add function to check entry presence

The current linuxlist implementation has not convinient way to check if
a given element is actually contained in a list. However, this may be
helpful when we must be sure that a pointer to a list element is still

Change-Id: Id1e8281d9d9f34277095ce9307e298bf29affa71
Related: SYS#4971
M include/osmocom/core/linuxlist.h
1 file changed, 14 insertions(+), 0 deletions(-)

  git pull ssh:// refs/changes/13/24813/1

diff --git a/include/osmocom/core/linuxlist.h b/include/osmocom/core/linuxlist.h
index f28f88b..d450bb9 100644
--- a/include/osmocom/core/linuxlist.h
+++ b/include/osmocom/core/linuxlist.h
@@ -394,6 +394,20 @@
 	return i;
+/*! Check whether a given element actually exists in the list.
+ *  \param head the llist head of the list to check.
+ *  \param entry the element to check.
+ *  \returns true if the element exists in the list, false otherwise.
+ */
+static inline bool llist_contains(struct llist_head *head, struct llist_head *entry)
+	struct llist_head *llist_entry;
+	llist_for_each(llist_entry, head) {
+		if (llist_entry == entry)
+			return true;
+	}
+	return false;
 /*! Double linked lists with a single pointer list head.

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id1e8281d9d9f34277095ce9307e298bf29affa71
Gerrit-Change-Number: 24813
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list