Lines Matching refs:list

5  *  Intended to work with a list sentinel which is created as an empty
6 * list. Insert & delete are O(1).
45 * Remove an element from list.
56 * Insert an element to the list head.
58 * \param list list.
61 #define insert_at_head(list, elem) \
63 (elem)->prev = list; \
64 (elem)->next = (list)->next; \
65 (list)->next->prev = elem; \
66 (list)->next = elem; \
70 * Insert an element to the list tail.
72 * \param list list.
75 #define insert_at_tail(list, elem) \
77 (elem)->next = list; \
78 (elem)->prev = (list)->prev; \
79 (list)->prev->next = elem; \
80 (list)->prev = elem; \
84 * Move an element to the list head.
86 * \param list list.
89 #define move_to_head(list, elem) \
92 insert_at_head(list, elem); \
96 * Move an element to the list tail.
98 * \param list list.
101 #define move_to_tail(list, elem) \
104 insert_at_tail(list, elem); \
108 * Make a empty list empty.
110 * \param sentinel list (sentinel element).
119 * Get list first element.
121 * \param list list.
125 #define first_elem(list) ((list)->next)
128 * Get list last element.
130 * \param list list.
134 #define last_elem(list) ((list)->prev)
155 * Test whether element is at end of the list.
157 * \param list list.
160 * \return non-zero if element is at end of list, or zero otherwise.
162 #define at_end(list, elem) ((elem) == (list))
165 * Test if a list is empty.
167 * \param list list.
169 * \return non-zero if list empty, or zero otherwise.
171 #define is_empty_list(list) ((list)->next == (list))
174 * Walk through the elements of a list.
177 * \param list list.
182 #define foreach(ptr, list) \
183 for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next )
186 * Walk through the elements of a list.
188 * Same as #foreach but lets you unlink the current value during a list
189 * traversal. Useful for freeing a list, element by element.
193 * \param list list.
198 #define foreach_s(ptr, t, list) \
199 for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next)