| 1 |
#ifndef XLIST_H |
| 2 |
#define XLIST_H |
| 3 |
|
| 4 |
#ifdef __cplusplus |
| 5 |
extern "C" |
| 6 |
{ |
| 7 |
#endif /* __cplusplus */ |
| 8 |
|
| 9 |
struct xlist_node { |
| 10 |
void *data; |
| 11 |
struct xlist_node *next; |
| 12 |
struct xlist_node *prev; |
| 13 |
}; |
| 14 |
|
| 15 |
typedef void (*xlist_destructor_t)(void *data); |
| 16 |
|
| 17 |
struct xlist_node *xlist_new(void *data); |
| 18 |
void xlist_destroy(struct xlist_node *list, xlist_destructor_t destructor); |
| 19 |
void xlist_append_item(struct xlist_node *list, struct xlist_node *item); |
| 20 |
void xlist_remove_item(struct xlist_node *item); |
| 21 |
struct xlist_node *xlist_shift(struct xlist_node *list); |
| 22 |
int xlist_empty(const struct xlist_node *list); |
| 23 |
size_t xlist_length(const struct xlist_node *list); |
| 24 |
|
| 25 |
#ifdef __cplusplus |
| 26 |
} |
| 27 |
#endif /* __cplusplus */ |
| 28 |
|
| 29 |
#endif /* XLIST_H */ |