[S] Change in libosmocore[master]: linuxlist.h: add llist_last_entry_or_null macro
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/40724?usp=email ) Change subject: linuxlist.h: add llist_last_entry_or_null macro ...................................................................... linuxlist.h: add llist_last_entry_or_null macro Related: OS#6705 Change-Id: Iaa5c8900434fe327a9c8b072182624a7fbfb369c --- M include/osmocom/core/linuxlist.h 1 file changed, 10 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/include/osmocom/core/linuxlist.h b/include/osmocom/core/linuxlist.h index 2fc3fa7..8c8b1bc 100644 --- a/include/osmocom/core/linuxlist.h +++ b/include/osmocom/core/linuxlist.h @@ -254,6 +254,16 @@ #define llist_first_entry_or_null(ptr, type, member) \ (!llist_empty(ptr) ? llist_first_entry(ptr, type, member) : NULL) +/*! Get the last element from a list, or NULL. + * \param ptr the list head to take the element from. + * \param type the type of the struct this is embedded in. + * \param member the name of the list_head within the struct. + * + * Note that if the list is empty, it returns NULL. + */ +#define llist_last_entry_or_null(ptr, type, member) \ + (!llist_empty(ptr) ? llist_last_entry(ptr, type, member) : NULL) + /*! Iterate over a linked list. * \param pos the llist_head to use as a loop counter. * \param head the head of the list over which to iterate. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40724?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Iaa5c8900434fe327a9c8b072182624a7fbfb369c Gerrit-Change-Number: 40724 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas@eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: pespin <pespin@sysmocom.de>
participants (1)
-
pespin