summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'util_double_list.h')
-rw-r--r--util_double_list.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/util_double_list.h b/util_double_list.h
index 27e0761b..7e48b26c 100644
--- a/util_double_list.h
+++ b/util_double_list.h
@@ -98,13 +98,19 @@ 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
104#ifndef container_of 110#ifndef container_of
105#define container_of(ptr, sample, member) \ 111#define container_of(ptr, sample, member) \
106 (void *)((char *)(ptr) \ 112 (void *)((char *)(ptr) \
107 - ((char *)&(sample)->member - (char *)(sample))) 113 - ((char *)&((typeof(sample))0)->member))
108#endif 114#endif
109 115
110#define LIST_FOR_EACH_ENTRY(pos, head, member) \ 116#define LIST_FOR_EACH_ENTRY(pos, head, member) \