73#define CSTL_SLIST_INITIALIZER(NAME, TYPE, MEMB) \
80 .off = offsetof(TYPE, MEMB), \
92#define DECLARE_CSTL_SLIST(NAME, TYPE, MEMB) \
93 struct cstl_slist NAME = CSTL_SLIST_INITIALIZER(NAME, TYPE, MEMB)
103 struct cstl_slist *
const sl,
const size_t off)
133 struct cstl_slist * sl,
void * before,
void * obj);
void cstl_xtor_func_t(void *obj, void *priv)
Type for functions called to construct, clear, or destroy an object.
int cstl_visit_func_t(void *obj, void *priv)
Type for visit callbacks from objects supporting foreach.
int cstl_compare_func_t(const void *obj1, const void *obj2, void *priv)
Function type for comparing (in)equality of two objects.
void * cstl_slist_back(const struct cstl_slist *sl)
Get a pointer to the last object in the list.
void cstl_slist_insert_after(struct cstl_slist *sl, void *before, void *obj)
Insert a new object into the list.
void * cstl_slist_pop_front(struct cstl_slist *sl)
Remove the first item in the list and return it.
void cstl_slist_clear(struct cstl_slist *sl, cstl_xtor_func_t *clr)
Remove objects from and reinitialize a list.
void cstl_slist_reverse(struct cstl_slist *sl)
Reverse the order of items in the list.
static size_t cstl_slist_size(const struct cstl_slist *sl)
Get the number of objects in the list.
void cstl_slist_sort(struct cstl_slist *sl, cstl_compare_func_t *cmp, void *priv)
Sort the items in a list.
void cstl_slist_push_front(struct cstl_slist *sl, void *obj)
Insert a new object at the front of the list.
void cstl_slist_swap(struct cstl_slist *const a, struct cstl_slist *const b)
Swap the list objects at the two given locations.
int cstl_slist_foreach(struct cstl_slist *sl, cstl_visit_func_t *visit, void *priv)
Call a user-supplied function for each object in a list.
void * cstl_slist_front(const struct cstl_slist *sl)
Get a pointer to the first object in the list.
static void cstl_slist_init(struct cstl_slist *const sl, const size_t off)
Initialize a slist object.
void * cstl_slist_erase_after(struct cstl_slist *sl, void *bef)
Remove an object from the list.
void cstl_slist_concat(struct cstl_slist *list, struct cstl_slist *more)
Append one list to the end of another.
void cstl_slist_push_back(struct cstl_slist *sl, void *obj)
Insert a new object at the back of the list.
Node to anchor an element within a list.