23 #include "uys_alloc.h"
37 list->destroy = destroy;
57 list->destroy != NULL) {
69 memset(list, 0,
sizeof(
List));
91 new_element->data = (
void *)data;
93 if (element == NULL) {
98 list->tail = new_element;
100 new_element->next = list->head;
101 list->head = new_element;
107 if (element->next == NULL) {
108 list->tail = new_element;
110 new_element->next = element->next;
111 element->next = new_element;
139 if (element == NULL) {
143 *data = list->head->data;
144 old_element = list->head;
145 list->head = list->head->next;
154 if (element->next == NULL) {
157 *data = element->next->data;
158 old_element = element->next;
159 element->next = element->next->next;
160 if (element->next == NULL) {
161 list->tail = element;
int list_ins_next(List *list, ListElmt *element, const void *data)
Inserts an element just after element on list.
Interface for the linked list implementation.
void list_destroy(List *list)
Destroys the linked list specified by list.
void list_init(List *list, void(*destroy)(void *data))
Initializes the linked list specified by list.
int list_rem_next(List *list, ListElmt *element, void **data)
Removes the element just after element on list.
#define list_size(list)
evaluates to the number of elements on list.
structure for linked lists.
structure for linked list elements.