using linked lists instead of arrays
[radsecproxy.git] / list.h
1 struct list_node {
2     struct list_node *next;
3     void *data;
4 };
5
6 struct list {
7     struct list_node *first, *last;
8 };
9
10 /* allocates and initialises list structure; returns NULL if malloc fails */
11 struct list *list_create();
12
13 /* frees all memory associated with the list */
14 void list_destroy(struct list *list);
15
16 /* appends entry to list; returns 1 if ok, 0 if malloc fails */
17 int list_add(struct list *list, void *data);
18
19 /* returns first node */
20 struct list_node *list_first(struct list *list);
21
22 /* returns the next node after the argument */
23 struct list_node *list_next(struct list_node *node);