chiark / gitweb /
Commit 2.4.5-5 as unpacked
[inn-innduct.git] / include / inn / list.h
1 /*  $Id: list.h 6168 2003-01-21 06:27:32Z alexk $
2 **
3 */
4
5 #ifndef INN_LIST_H
6 #define INN_LIST_H 1
7
8 #include <inn/defines.h>
9
10 struct node {
11     struct node *succ;
12     struct node *pred;
13 };
14
15 struct list {
16     struct node *head;
17     struct node *tail;
18     struct node *tailpred;
19 };
20
21 BEGIN_DECLS
22
23 /* initialise a new list */
24 void list_new(struct list *list);
25
26 /* add a node to the head of the list */
27 struct node *list_addhead(struct list *list, struct node *node);
28
29 /* add a node to the tail of the list */
30 struct node *list_addtail(struct list *list, struct node *node);
31
32 /* return a pointer to the first node on the list */
33 struct node *list_head(struct list *list);
34
35 /* return a pointer to the last node on the list */
36 struct node *list_tail(struct list *list);
37
38 struct node *list_succ(struct node *node);
39 struct node *list_pred(struct node *node);
40
41 struct node *list_remhead(struct list *list);
42 struct node *list_remove(struct node *node);
43 struct node *list_remtail(struct list *list);
44 struct node *list_insert(struct list *list, struct node *node,
45                          struct node *pred);
46
47 bool list_isempty(struct list *list);
48
49 END_DECLS
50
51 #endif /* INN_LIST_H */