45 typedef struct _CMimeListElem {
47 struct _CMimeListElem *
prev;
48 struct _CMimeListElem *
next;
55 typedef struct _CMimeList {
57 void (*destroy)(
void *data);
166 #define cmime_list_size(list) ((list)->size)
172 #define cmime_list_head(list) ((list)->head)
178 #define cmime_list_tail(list) ((list)->tail)
184 #define cmime_list_is_head(elem) ((elem)->prev == NULL ? 1 : 0)
190 #define cmime_list_is_tail(elem) ((elem)->next == NULL ? 1 : 0)
196 #define cmime_list_data(elem) ((elem)->data)
202 #define cmime_list_next(elem) ((elem)->next)
208 #define cmime_list_prev(elem) ((elem)->prev)
int cmime_list_prepend(CMimeList_T *list, void *data)
Prepend data to a list.
Definition: cmime_list.c:217
int cmime_list_map_new(CMimeList_T *list, CMimeList_T **new_list, void *(*func)(CMimeListElem_T *elem, void *args), void *args)
Iterates over list and calls function func with every element, return value of func will be saved in ...
Definition: cmime_list.c:236
int size
Definition: cmime_list.h:56
struct _CMimeListElem * prev
Definition: cmime_list.h:47
int cmime_list_free(CMimeList_T *list)
Free a CMimeList_T list.
Definition: cmime_list.c:45
An element of a CMimeList_T list.
Definition: cmime_list.h:45
int cmime_list_insert_prev(CMimeList_T *list, CMimeListElem_T *elem, void *data)
Insert new element previous to elem.
Definition: cmime_list.c:170
CMimeListElem_T * head
Definition: cmime_list.h:58
void cmime_list_map(CMimeList_T *list, void(*func)(CMimeListElem_T *elem, void *args), void *args)
Iterates over list and calls function for every element with the current element. ...
Definition: cmime_list.c:224
int cmime_list_insert_next(CMimeList_T *list, CMimeListElem_T *elem, void *data)
Insert new element next to elem.
Definition: cmime_list.c:129
Double linked list implementation.
Definition: cmime_list.h:55
void * cmime_list_pop_head(CMimeList_T *list)
Remove head element from list an return data pointer.
Definition: cmime_list.c:113
CMimeListElem_T * tail
Definition: cmime_list.h:59
void * cmime_list_pop_tail(CMimeList_T *list)
Remove tail element from list and return data pointer.
Definition: cmime_list.c:98
int cmime_list_remove(CMimeList_T *list, CMimeListElem_T *elem, void **data)
Remove an element from list.
Definition: cmime_list.c:62
struct _CMimeListElem * next
Definition: cmime_list.h:48
int cmime_list_new(CMimeList_T **list, void(*destroy)(void *data))
Creates a new CMimeList_T list.
Definition: cmime_list.c:29
int cmime_list_append(CMimeList_T *list, void *data)
Append data to the end of a list.
Definition: cmime_list.c:210
void * data
Definition: cmime_list.h:46