summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Scally <dan.scally@ideasonboard.com>2022-12-01 12:28:07 +0000
committerDaniel Scally <dan.scally@ideasonboard.com>2022-12-06 14:42:12 +0000
commit434ad5255f28a0a2fe847e8504d18aa5ef10b2c9 (patch)
tree382f4439a581256cdb82c22d7d3bfbcb774482ff
parent21913d5f728023954348dd25019fcf848d824ae6 (diff)
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 <kieran.bingham@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
-rw-r--r--include/uvcgadget/list.h3
1 files changed, 3 insertions, 0 deletions
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)