7 #define CHECK(x) (void)(x)
9 #define CHECK(x) _check(x)
14 list_item *head, *tail;
15 void (*elt_dtor)(void *);
23 assert( (!l->head && l->length == 0) ||
24 ( l->head && l->length != 0) );
25 assert( (!l->head && !l->tail) ||
26 ( l->head && l->tail) );
30 l_new(void (*elt_dtor)(void *))
32 list *l = malloc(sizeof *l);
35 *l = (list){.elt_dtor = elt_dtor};
50 l_length(const list *l)
52 return l ? l->length : 0;
56 l_is_empty(const list *l)
58 return !l || !l->head;
62 l_first(const list *l)
64 return l ? l->head : NULL;
70 return l ? l->tail : NULL;