125 for(l = *list; l->next != NULL; l = l->next);
149 ((
struct list *)item)->next = NULL;
169 ((
struct list *)item)->next = *list;
190 if(((
struct list *)*list)->next == NULL) {
196 for(l = *list; l->next->next != NULL; l = l->next);
220 *list = ((
struct list *)*list)->next;
246 for(l = *list; l != NULL; l = l->next) {
277 for(l = *list; l != NULL; l = l->next) {
302 if(previtem == NULL) {
306 ((
struct list *)newitem)->next = ((
struct list *)previtem)->next;
307 ((
struct list *)previtem)->next = newitem;
324 return item == NULL ? NULL : ((
struct list *)item)->next;
341 for(l = *list; l != NULL; l = l->next) {
void list_push(list_t list, void *item)
Add an item to the start of the list.
void list_copy(list_t dest, list_t src)
Duplicate a list.
void list_insert(list_t list, void *previtem, void *newitem)
Insert an item after a specified item on the list.
bool list_contains(list_t list, void *item)
Check if the list contains an item.
void ** list_t
The linked list type.
void * list_tail(list_t list)
Get the tail of a list.
void * list_chop(list_t list)
Remove the last object on the list.
Linked list manipulation routines.
void * list_head(list_t list)
Get a pointer to the first element of a list.
void list_add(list_t list, void *item)
Add an item at the end of a list.
void list_init(list_t list)
Initialize a list.
void * list_pop(list_t list)
Remove the first object on a list.
void list_remove(list_t list, void *item)
Remove a specific element from a list.
void * list_item_next(void *item)
Get the next item following this item.
int list_length(list_t list)
Get the length of a list.