--- a/docs/Writerside/topics/list.h.md Sun Dec 14 16:21:09 2025 +0100 +++ b/docs/Writerside/topics/list.h.md Sun Dec 14 17:30:17 2025 +0100 @@ -10,23 +10,16 @@ #include <cx/linked_list.h> CxList *cxLinkedListCreate(const CxAllocator *allocator, - cx_compare_func comparator, size_t elem_size); - -CxList *cxLinkedListCreateSimple(size_t elem_size); + size_t elem_size); #include <cx/array_list.h> CxList *cxArrayListCreate(const CxAllocator *allocator, - cx_compare_func comparator, size_t elem_size, - size_t initial_capacity); - -CxList *cxArrayListCreateSimple(size_t elem_size, - size_t initial_capacity); + size_t elem_size, size_t initial_capacity); ``` The function `cxLinkedListCreate()` creates a new linked list with the specified `allocator` which stores elements of size `elem_size`. -The elements are supposed to be compared with the specified `comparator` (cf. [](#access-and-find)). -The function `cxLinkedListCreateSimple()` will use the [default allocator](allocator.h.md#default-allocator) and does not specify a compare function. +The elements are supposed to be compared with the specified `comparator` (cf. [](#access-and-find)). Array lists can be created with `cxArrayListCreate()` where the additional argument `initial_capacity` specifies for how many elements the underlying array shall be initially allocated. @@ -51,10 +44,10 @@ CxList *create_pattern_list(void) { // create a linked list to store patterns - CxList *list = cxLinkedListCreateSimple(sizeof(regex_t)); + CxList *list = cxLinkedListCreate(NULL, sizeof(regex_t)); // automatically free the pattern when list gets destroyed - cxDefineDestructor(list, regfree); + cxSetDestructor(list, regfree); return list; } @@ -512,7 +505,6 @@ CxList *my_list_create( const CxAllocator *allocator, - cx_compare_func cmpfun, size_t elem_size ) { if (allocator == NULL) { @@ -522,7 +514,7 @@ my_list *list = cxCalloc(allocator, 1, sizeof(my_list)); if (list == NULL) return NULL; cx_list_init((CxList*)list, &my_list_class, - allocator, cmpfun, elem_size); + allocator, elem_size); // initialize your custom list data here