From 434ad5255f28a0a2fe847e8504d18aa5ef10b2c9 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Thu, 1 Dec 2022 12:28:07 +0000 Subject: list: Add list_next_entry() Lists are useful for more than just iteration! Add a macro to fetch just the next item in the list. Reviewed-by: Kieran Bingham Signed-off-by: Daniel Scally --- include/uvcgadget/list.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/uvcgadget/list.h b/include/uvcgadget/list.h index 8854c6e..452df30 100644 --- a/include/uvcgadget/list.h +++ b/include/uvcgadget/list.h @@ -74,6 +74,9 @@ static inline void list_remove(struct list_entry *entry) #define list_last_entry(list, type, member) \ list_entry((list)->prev, type, member) +#define list_next_entry(entry, type, member) \ + list_entry((entry)->next, type, member) + #define list_for_each(entry, list) \ for (entry = (list)->next; entry != (list); entry = entry->next) -- cgit v1.2.3