16#ifndef CCC_IMPL_SINGLY_LINKED_LIST_H
17#define CCC_IMPL_SINGLY_LINKED_LIST_H
56 size_t sll_elem_offset;
68void ccc_impl_sll_push_front(
struct ccc_sll *,
struct ccc_sll_elem *);
73#define ccc_impl_sll_init(impl_sll_name, impl_struct_name, \
74 impl_sll_elem_field, impl_cmp_fn, impl_alloc_fn, \
77 .nil.n = &(impl_sll_name).nil, \
78 .sizeof_type = sizeof(impl_struct_name), \
79 .sll_elem_offset = offsetof(impl_struct_name, impl_sll_elem_field), \
81 .alloc = (impl_alloc_fn), \
82 .cmp = (impl_cmp_fn), \
83 .aux = (impl_aux_data), \
87#define ccc_impl_sll_emplace_front(list_ptr, struct_initializer...) \
89 typeof(struct_initializer) *impl_sll_res = NULL; \
90 struct ccc_sll *impl_sll = (list_ptr); \
93 if (!impl_sll->alloc) \
95 impl_sll_res = NULL; \
99 impl_sll_res = impl_sll->alloc(NULL, impl_sll->sizeof_type); \
102 *impl_sll_res = struct_initializer; \
103 ccc_impl_sll_push_front( \
104 impl_sll, ccc_sll_elem_in(impl_sll, impl_sll_res)); \
struct ccc_sll_elem ccc_sll_elem
A singly linked list intrusive element to embedded in a user type.
Definition: singly_linked_list.h:70
ccc_threeway_cmp ccc_any_type_cmp_fn(ccc_any_type_cmp)
A callback function for comparing two elements in a container.
Definition: types.h:320
void * ccc_any_alloc_fn(void *ptr, size_t size, void *aux)
An allocation function at the core of all containers.
Definition: types.h:312