aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark2016-06-21 10:33:30 -0500
committerRob Clark2016-07-20 18:42:21 -0500
commit1d1e01b2350e40711fcf19e200e46e2edfd887b2 (patch)
tree43da328971e543feb35f4a02a2fe3aa43b71da92 /util_double_list.h
parentdd1f372001d4e6de648fa33b6b74d89aaa24cf75 (diff)
downloadexternal-libdrm-1d1e01b2350e40711fcf19e200e46e2edfd887b2.tar.gz
external-libdrm-1d1e01b2350e40711fcf19e200e46e2edfd887b2.tar.xz
external-libdrm-1d1e01b2350e40711fcf19e200e46e2edfd887b2.zip
list: add first/last entry macros
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'util_double_list.h')
-rw-r--r--util_double_list.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/util_double_list.h b/util_double_list.h
index 27e0761b..5d01f52d 100644
--- a/util_double_list.h
+++ b/util_double_list.h
@@ -98,6 +98,12 @@ static inline void list_delinit(struct list_head *item)
98#define LIST_ENTRY(__type, __item, __field) \ 98#define LIST_ENTRY(__type, __item, __field) \
99 ((__type *)(((char *)(__item)) - offsetof(__type, __field))) 99 ((__type *)(((char *)(__item)) - offsetof(__type, __field)))
100 100
101#define LIST_FIRST_ENTRY(__ptr, __type, __field) \
102 LIST_ENTRY(__type, (__ptr)->next, __field)
103
104#define LIST_LAST_ENTRY(__ptr, __type, __field) \
105 LIST_ENTRY(__type, (__ptr)->prev, __field)
106
101#define LIST_IS_EMPTY(__list) \ 107#define LIST_IS_EMPTY(__list) \
102 ((__list)->next == (__list)) 108 ((__list)->next == (__list))
103 109