Lines Matching refs:node
20 static list_node_t* list_free_node_(list_t* list, list_node_t* node);
55 for (const list_node_t* node = list_begin(list); node != list_end(list); in list_contains() local
56 node = list_next(node)) { in list_contains()
57 if (list_node(node) == data) return true; in list_contains()
94 list_node_t* node = (list_node_t*)list->allocator->alloc(sizeof(list_node_t)); in list_insert_after() local
95 if (!node) return false; in list_insert_after()
97 node->next = prev_node->next; in list_insert_after()
98 node->data = data; in list_insert_after()
99 prev_node->next = node; in list_insert_after()
100 if (list->tail == prev_node) list->tail = node; in list_insert_after()
109 list_node_t* node = (list_node_t*)list->allocator->alloc(sizeof(list_node_t)); in list_prepend() local
110 if (!node) return false; in list_prepend()
111 node->next = list->head; in list_prepend()
112 node->data = data; in list_prepend()
113 list->head = node; in list_prepend()
123 list_node_t* node = (list_node_t*)list->allocator->alloc(sizeof(list_node_t)); in list_append() local
124 if (!node) return false; in list_append()
125 node->next = NULL; in list_append()
126 node->data = data; in list_append()
128 list->head = node; in list_append()
129 list->tail = node; in list_append()
131 list->tail->next = node; in list_append()
132 list->tail = node; in list_append()
151 for (list_node_t *prev = list->head, *node = list->head->next; node; in list_remove() local
152 prev = node, node = node->next) in list_remove()
153 if (node->data == data) { in list_remove()
154 prev->next = list_free_node_(list, node); in list_remove()
155 if (list->tail == node) list->tail = prev; in list_remove()
164 for (list_node_t* node = list->head; node;) in list_clear() local
165 node = list_free_node_(list, node); in list_clear()
176 for (list_node_t* node = list->head; node;) { in list_foreach() local
177 list_node_t* next = node->next; in list_foreach()
178 if (!callback(node->data, context)) return node; in list_foreach()
179 node = next; in list_foreach()
194 list_node_t* list_next(const list_node_t* node) { in list_next() argument
195 CHECK(node != NULL); in list_next()
196 return node->next; in list_next()
199 void* list_node(const list_node_t* node) { in list_node() argument
200 CHECK(node != NULL); in list_node()
201 return node->data; in list_node()
204 static list_node_t* list_free_node_(list_t* list, list_node_t* node) { in list_free_node_() argument
206 CHECK(node != NULL); in list_free_node_()
208 list_node_t* next = node->next; in list_free_node_()
210 if (list->free_cb) list->free_cb(node->data); in list_free_node_()
211 list->allocator->free(node); in list_free_node_()