diff -r eafb45eefc51 -r 309e8b08c60e src/cx/linked_list.h --- a/src/cx/linked_list.h Mon Jan 23 20:22:11 2023 +0100 +++ b/src/cx/linked_list.h Mon Jan 23 20:34:18 2023 +0100 @@ -63,23 +63,6 @@ ) __attribute__((__nonnull__)); /** - * Allocates a linked list for storing pointers. - * - * If you want to store the elements directly in this list, use cxLinkedListCreate(). - * - * @remark Since only pointers are stored in this list, a possible destructor - * MAY free the memory pointed to by its argument in order to prevent memory leaks. - * - * @param allocator the allocator for allocating the list nodes - * @param comparator the comparator for the elements - * @return the created list - */ -CxList *cxPointerLinkedListCreate( - CxAllocator const *allocator, - CxListComparator comparator -) __attribute__((__nonnull__)); - -/** * Finds the node at a certain index. * * This function can be used to start at an arbitrary position within the list. @@ -109,8 +92,6 @@ * @param start a pointer to the start node * @param loc_advance the location of the pointer to advance * @param loc_data the location of the \c data pointer within your node struct - * @param follow_ptr \c false if the pointer denoted by \p loc_data shall be passed to the \p cmp_func. - * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func. * @param cmp_func a compare function to compare \p elem against the node data * @param elem a pointer to the element to find * @return the index of the element or a past-one index if the element could not be found @@ -119,7 +100,6 @@ void const *start, ptrdiff_t loc_advance, ptrdiff_t loc_data, - bool follow_ptr, CxListComparator cmp_func, void const *elem ) __attribute__((__nonnull__)); @@ -339,20 +319,13 @@ /** * Sorts a linked list based on a comparison function. * - * This function can work with linked lists of the following structures: + * This function can work with linked lists of the following structure: * \code * typedef struct node node; * struct node { * node* prev; * node* next; - * my_payload data; // in this case set follow_ptr = 0 - * } - * - * typedef struct ptr_node ptr_node; - * struct ptr_node { - * ptr_node* prev; - * ptr_node* next; - * my_payload* data; // in this case set follow_ptr = 1 + * my_payload data; * } * \endcode * @@ -363,8 +336,6 @@ * @param loc_prev the location of a \c prev pointer within your node struct (negative if not present) * @param loc_next the location of a \c next pointer within your node struct (required) * @param loc_data the location of the \c data pointer within your node struct - * @param follow_ptr \c false if the pointer denoted by \p loc_data shall be passed to the \p cmp_func. - * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func. * @param cmp_func the compare function defining the sort order */ void cx_linked_list_sort( @@ -373,26 +344,19 @@ ptrdiff_t loc_prev, ptrdiff_t loc_next, ptrdiff_t loc_data, - bool follow_ptr, CxListComparator cmp_func -) __attribute__((__nonnull__(1, 7))); +) __attribute__((__nonnull__(1, 6))); /** * Compares two lists element wise. * - * The \c follow_ptr flags have the following meaning: if \c false, the pointer denoted by \p loc_data shall - * directly be passed to the \p cmp_func. - * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func. - * * \note Both list must have the same structure. * * @param begin_left the begin of the left list (\c NULL denotes an empty list) * @param begin_right the begin of the right list (\c NULL denotes an empty list) * @param loc_advance the location of the pointer to advance * @param loc_data the location of the \c data pointer within your node struct - * @param follow_ptr_left indicates whether pointers in the left list shall be dereferenced - * @param follow_ptr_right indicates whether pointers in the right list shall be dereferenced * @param cmp_func the function to compare the elements * @return the first non-zero result of invoking \p cmp_func or: negative if the left list is smaller than the * right list, positive if the left list is larger than the right list, zero if both lists are equal. @@ -402,10 +366,8 @@ void const *begin_right, ptrdiff_t loc_advance, ptrdiff_t loc_data, - bool follow_ptr_left, - bool follow_ptr_right, CxListComparator cmp_func -) __attribute__((__nonnull__(7))); +) __attribute__((__nonnull__(5))); /** * Reverses the order of the nodes in a linked list.