126 for(l = *list; l->next !=
NULL; l = l->next);
150 ((
struct list *)item)->next =
NULL;
172 ((
struct list *)item)->next = *list;
193 if(((
struct list *)*list)->next ==
NULL) {
199 for(l = *list; l->next->next !=
NULL; l = l->next);
223 *list = ((
struct list *)*list)->next;
249 for(l = *list; l !=
NULL; l = l->next) {
280 for(l = *list; l !=
NULL; l = l->next) {
305 if(previtem ==
NULL) {
309 ((
struct list *)newitem)->next = ((
struct list *)previtem)->next;
310 ((
struct list *)previtem)->next = newitem;
327 return item ==
NULL?
NULL: ((
struct list *)item)->next;
void * list_pop(list_t list)
Remove the first object on a list.
Linked list manipulation routines.
void list_push(list_t list, void *item)
Add an item to the start of the list.
void ** list_t
The linked list type.
void list_copy(list_t dest, list_t src)
Duplicate a list.
void * list_item_next(void *item)
Get the next item following this item.
#define NULL
The null pointer.
void list_remove(list_t list, void *item)
Remove a specific element from a list.
void list_insert(list_t list, void *previtem, void *newitem)
Insert an item after a specified item on the list.
int list_length(list_t list)
Get the length of a list.
void list_init(list_t list)
Initialize a list.
void * list_head(list_t list)
Get a pointer to the first element of a list.
void * list_tail(list_t list)
Get the tail of a list.
void list_add(list_t list, void *item)
Add an item at the end of a list.
void * list_chop(list_t list)
Remove the last object on the list.