]> mj.ucw.cz Git - umpf.git/blob - lists.h
fix reading email
[umpf.git] / lists.h
1 struct node {
2         struct node* prev;
3         struct node* next;
4 };
5
6 struct list {
7         struct node head;
8 };
9
10 #define LIST_FOREACH(p,list) for(p=(void*)(list)->head.next; (struct node*)p!=&(list)->head; p=(void*)((struct node*) p)->next)
11 void list_init(struct list* l);
12 int list_is_empty(struct list* l);
13 void* list_first(struct list* l);
14 void* list_last(struct list* l);
15 void* list_prev(struct list* l, struct node* n);
16 void* list_next(struct list* l, struct node* n);
17 void list_add_first(struct list* l, struct node* new);
18 void list_add_last(struct list* l, struct node* new);
19 void list_add_after(struct node* orig, struct node* new);
20 void list_add_before(struct node* orig, struct node* new);
21 void list_del_node(struct node* n);
22 void* list_del_first(struct list* l);
23 void* list_del_last(struct list* l);
24 void list_cat(struct list* dst, struct list* src);