Lines Matching refs:list

5  *  Intended to work with a list sentinal which is created as an empty
6 * list. Insert & delete are O(1).
46 * Remove an element from list.
57 * Insert an element to the list head.
59 * \param list list.
62 #define insert_at_head(list, elem) \
64 (elem)->prev = list; \
65 (elem)->next = (list)->next; \
66 (list)->next->prev = elem; \
67 (list)->next = elem; \
71 * Insert an element to the list tail.
73 * \param list list.
76 #define insert_at_tail(list, elem) \
78 (elem)->next = list; \
79 (elem)->prev = (list)->prev; \
80 (list)->prev->next = elem; \
81 (list)->prev = elem; \
85 * Move an element to the list head.
87 * \param list list.
90 #define move_to_head(list, elem) \
93 insert_at_head(list, elem); \
97 * Move an element to the list tail.
99 * \param list list.
102 #define move_to_tail(list, elem) \
105 insert_at_tail(list, elem); \
109 * Make a empty list empty.
111 * \param sentinal list (sentinal element).
120 * Get list first element.
122 * \param list list.
126 #define first_elem(list) ((list)->next)
129 * Get list last element.
131 * \param list list.
135 #define last_elem(list) ((list)->prev)
156 * Test whether element is at end of the list.
158 * \param list list.
161 * \return non-zero if element is at end of list, or zero otherwise.
163 #define at_end(list, elem) ((elem) == (list))
166 * Test if a list is empty.
168 * \param list list.
170 * \return non-zero if list empty, or zero otherwise.
172 #define is_empty_list(list) ((list)->next == (list))
175 * Walk through the elements of a list.
178 * \param list list.
183 #define foreach(ptr, list) \
184 for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next )
187 * Walk through the elements of a list.
189 * Same as #foreach but lets you unlink the current value during a list
190 * traversal. Useful for freeing a list, element by element.
194 * \param list list.
199 #define foreach_s(ptr, t, list) \
200 for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next)