mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-25 18:50:10 +01:00
list: add first/last entry macros
Signed-off-by: Rob Clark <robclark@freedesktop.org>
This commit is contained in:
parent
dd1f372001
commit
1d1e01b235
1 changed files with 6 additions and 0 deletions
|
|
@ -98,6 +98,12 @@ static inline void list_delinit(struct list_head *item)
|
|||
#define LIST_ENTRY(__type, __item, __field) \
|
||||
((__type *)(((char *)(__item)) - offsetof(__type, __field)))
|
||||
|
||||
#define LIST_FIRST_ENTRY(__ptr, __type, __field) \
|
||||
LIST_ENTRY(__type, (__ptr)->next, __field)
|
||||
|
||||
#define LIST_LAST_ENTRY(__ptr, __type, __field) \
|
||||
LIST_ENTRY(__type, (__ptr)->prev, __field)
|
||||
|
||||
#define LIST_IS_EMPTY(__list) \
|
||||
((__list)->next == (__list))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue