diff -r 1e3cb39815f8 -r 28bc3e10ac28 src/cx/linked_list.h --- a/src/cx/linked_list.h Tue Oct 05 12:25:23 2021 +0200 +++ b/src/cx/linked_list.h Tue Oct 05 13:03:45 2021 +0200 @@ -45,8 +45,36 @@ extern "C" { #endif +/** + * Allocates a linked list for storing elements with \p item_size bytes each. + * + * Elements added to the list are copied. + * + * @param allocator the allocator for allocating the list nodes + * @param comparator the comparator for the elements + * @param item_size the size of each element in bytes + * @return the created list + */ CxList cxLinkedListCreate(CxAllocator allocator, CxListComparator comparator, size_t item_size); +/** + * Allocates a linked list for storing pointers. + * + * If you want to store the elements directly in this list, use cxLinkedListCreate(). + * + * @param allocator the allocator for allocating the list nodes + * @param comparator the comparator for the elements + * @return the created list + */ +CxList cxPointerLinkedListCreate(CxAllocator allocator, CxListComparator comparator); + +/** + * Deallocates the memory of the entire list. + * + * \attention If this is a pointer list, the memory the pointers are referring to is \em not freed. + * + * @param list the list + */ void cxLinkedListDestroy(CxList list); size_t cxLinkedListRecalculateSize(CxList list);