Lines Matching full:list
5 * Intended to work with a list sentinal which is created as an empty
6 * list. Insert & delete are O(1).
50 * Remove an element from list.
62 * Insert an element to the list head.
64 * \param list list.
67 #define insert_at_head(list, elem) \ argument
69 (elem)->prev = list; \
70 (elem)->next = (list)->next; \
71 (list)->next->prev = elem; \
72 (list)->next = elem; \
76 * Insert an element to the list tail.
78 * \param list list.
81 #define insert_at_tail(list, elem) \ argument
83 (elem)->next = list; \
84 (elem)->prev = (list)->prev; \
85 (list)->prev->next = elem; \
86 (list)->prev = elem; \
90 * Move an element to the list head.
92 * \param list list.
95 #define move_to_head(list, elem) \ argument
98 insert_at_head(list, elem); \
102 * Move an element to the list tail.
104 * \param list list.
107 #define move_to_tail(list, elem) \ argument
110 insert_at_tail(list, elem); \
114 * Make a empty list empty.
116 * \param sentinal list (sentinal element).
125 * Get list first element.
127 * \param list list.
131 #define first_elem(list) ((list)->next) argument
134 * Get list last element.
136 * \param list list.
140 #define last_elem(list) ((list)->prev) argument
161 * Test whether element is at end of the list.
163 * \param list list.
166 * \return non-zero if element is at end of list, or zero otherwise.
168 #define at_end(list, elem) ((elem) == (list)) argument
171 * Test if a list is empty.
173 * \param list list.
175 * \return non-zero if list empty, or zero otherwise.
177 #define is_empty_list(list) ((list)->next == (list)) argument
180 * Walk through the elements of a list.
183 * \param list list.
188 #define foreach(ptr, list) \ argument
189 for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next )
192 * Walk through the elements of a list.
194 * Same as #foreach but lets you unlink the current value during a list
195 * traversal. Useful for freeing a list, element by element.
199 * \param list list.
204 #define foreach_s(ptr, t, list) \ argument
205 for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next)