Lines Matching refs:list
10 #define GET_ITEM(list, item) ((void *)((uint8_t *)item - list->offset)) argument
11 #define GET_LINK(list, item) ((list_link *)((uint8_t *)item + list->offset)) argument
22 list_init_etc(struct list *list, int32_t offset) in list_init_etc() argument
24 list->link.next = list->link.prev = &list->link; in list_init_etc()
25 list->offset = offset; in list_init_etc()
30 list_init(struct list *list) in list_init() argument
32 list_init_etc(list, 0); in list_init()
40 list_add_link_to_head(struct list *list, void *_link) in list_add_link_to_head() argument
44 link->next = list->link.next; in list_add_link_to_head()
45 link->prev = &list->link; in list_add_link_to_head()
47 list->link.next->prev = link; in list_add_link_to_head()
48 list->link.next = link; in list_add_link_to_head()
56 list_add_link_to_tail(struct list *list, void *_link) in list_add_link_to_tail() argument
60 link->next = &list->link; in list_add_link_to_tail()
61 link->prev = list->link.prev; in list_add_link_to_tail()
63 list->link.prev->next = link; in list_add_link_to_tail()
64 list->link.prev = link; in list_add_link_to_tail()
83 get_next_link(struct list *list, list_link *link) in get_next_link() argument
85 if (link->next == &list->link) in get_next_link()
93 get_prev_link(struct list *list, list_link *link) in get_prev_link() argument
95 if (link->prev == &list->link) in get_prev_link()
109 list_get_next_item(struct list *list, void *item) in list_get_next_item() argument
114 return list_is_empty(list) ? NULL : GET_ITEM(list, list->link.next); in list_get_next_item()
116 link = get_next_link(list, GET_LINK(list, item)); in list_get_next_item()
117 return link != NULL ? GET_ITEM(list, link) : NULL; in list_get_next_item()
128 list_get_prev_item(struct list *list, void *item) in list_get_prev_item() argument
133 return list_is_empty(list) ? NULL : GET_ITEM(list, list->link.prev); in list_get_prev_item()
135 link = get_prev_link(list, GET_LINK(list, item)); in list_get_prev_item()
136 return link != NULL ? GET_ITEM(list, link) : NULL; in list_get_prev_item()
141 list_get_last_item(struct list *list) in list_get_last_item() argument
143 return list_is_empty(list) ? NULL : GET_ITEM(list, list->link.prev); in list_get_last_item()
152 list_add_item(struct list *list, void *item) in list_add_item() argument
154 list_add_link_to_tail(list, GET_LINK(list, item)); in list_add_item()
163 list_remove_item(struct list *list, void *item) in list_remove_item() argument
165 list_remove_link(GET_LINK(list, item)); in list_remove_item()
175 list_insert_item_before(struct list *list, void *before, void *item) in list_insert_item_before() argument
181 list_add_item(list, item); in list_insert_item_before()
185 beforeLink = GET_LINK(list, before); in list_insert_item_before()
186 link = GET_LINK(list, item); in list_insert_item_before()
201 list_remove_head_item(struct list *list) in list_remove_head_item() argument
205 if (list_is_empty(list)) in list_remove_head_item()
208 list_remove_link(link = list->link.next); in list_remove_head_item()
209 return GET_ITEM(list, link); in list_remove_head_item()
218 list_remove_tail_item(struct list *list) in list_remove_tail_item() argument
222 if (list_is_empty(list)) in list_remove_tail_item()
225 list_remove_link(link = list->link.prev); in list_remove_tail_item()
226 return GET_ITEM(list, link); in list_remove_tail_item()
236 list_move_to_list(struct list *sourceList, struct list *targetList) in list_move_to_list()