paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | |
| 2 | #ifndef _LINKLIST_H_ |
| 3 | #define _LINKLIST_H_ |
| 4 | |
| 5 | struct linklist_node |
| 6 | { |
| 7 | struct linklist_node *prev; |
| 8 | struct linklist_node *next; |
| 9 | |
| 10 | void *data; |
| 11 | }; |
| 12 | |
| 13 | struct linklist |
| 14 | { |
| 15 | int count; |
| 16 | struct linklist_node *head; |
| 17 | struct linklist_node *tail; |
| 18 | |
| 19 | int (*cmp) (void *, void *); |
| 20 | }; |
| 21 | |
| 22 | void *linklist_lookup (void *data, struct linklist *linklist); |
| 23 | int linklist_add (void *data, struct linklist *linklist); |
| 24 | int linklist_remove (void *data, struct linklist *linklist); |
| 25 | void linklist_remove_all (struct linklist *linklist); |
| 26 | |
| 27 | void linklist_head (struct linklist *linklist, struct linklist_node *node); |
| 28 | int linklist_end (struct linklist_node *node); |
| 29 | void linklist_next (struct linklist_node *node); |
| 30 | |
| 31 | struct linklist *linklist_create (); |
| 32 | void linklist_delete (struct linklist *); |
| 33 | |
| 34 | #endif /*_LINKLIST_H_*/ |
| 35 | |