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).
41 * Remove an element from list.
54 * Insert an element to the list head.
56 * \param list list.
59 #define insert_at_head(list, elem) \
61 (elem)->prev = list; \
62 (elem)->next = (list)->next; \
63 (list)->next->prev = elem; \
64 (list)->next = elem; \
68 * Insert an element to the list tail.
70 * \param list list.
73 #define insert_at_tail(list, elem) \
75 (elem)->next = list; \
76 (elem)->prev = (list)->prev; \
77 (list)->prev->next = elem; \
78 (list)->prev = elem; \
82 * Move an element to the list head.
84 * \param list list.
87 #define move_to_head(list, elem) \
90 insert_at_head(list, elem); \
94 * Move an element to the list tail.
96 * \param list list.
99 #define move_to_tail(list, elem) \
102 insert_at_tail(list, elem); \
106 * Make a empty list empty.
108 * \param sentinal list (sentinal element).
117 * Get list first element.
119 * \param list list.
123 #define first_elem(list) ((list)->next)
126 * Get list last element.
128 * \param list list.
132 #define last_elem(list) ((list)->prev)
153 * Test whether element is at end of the list.
155 * \param list list.
158 * \return non-zero if element is at end of list, or zero otherwise.
160 #define at_end(list, elem) ((elem) == (list))
163 * Test if a list is empty.
165 * \param list list.
167 * \return non-zero if list empty, or zero otherwise.
169 #define is_empty_list(list) ((list)->next == (list))
172 * Walk through the elements of a list.
175 * \param list list.
180 #define foreach(ptr, list) \
181 for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next )
184 * Walk through the elements of a list.
186 * Same as #foreach but lets you unlink the current value during a list
187 * traversal. Useful for freeing a list, element by element.
191 * \param list list.
196 #define foreach_s(ptr, t, list) \
197 for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next)