From 9a5e05a40698f7143002584aa635a07648c3c097 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 6 May 2003 12:01:13 +0000 Subject: [PATCH] list_next --- lib/datastruct/list.h | 5 +++++ libdm/datastruct/list.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib/datastruct/list.h b/lib/datastruct/list.h index 3084e88b5..6041c1dac 100644 --- a/lib/datastruct/list.h +++ b/lib/datastruct/list.h @@ -56,6 +56,11 @@ static inline int list_end(struct list *head, struct list *elem) return elem->n == head; } +static inline struct list *list_next(struct list *head, struct list *elem) +{ + return (list_end(head, elem) ? NULL : elem->n); +} + #define list_iterate(v, head) \ for (v = (head)->n; v != head; v = v->n) diff --git a/libdm/datastruct/list.h b/libdm/datastruct/list.h index 3084e88b5..6041c1dac 100644 --- a/libdm/datastruct/list.h +++ b/libdm/datastruct/list.h @@ -56,6 +56,11 @@ static inline int list_end(struct list *head, struct list *elem) return elem->n == head; } +static inline struct list *list_next(struct list *head, struct list *elem) +{ + return (list_end(head, elem) ? NULL : elem->n); +} + #define list_iterate(v, head) \ for (v = (head)->n; v != head; v = v->n)