1.1 --- a/src/cx/linked_list.h Mon Jan 23 20:22:11 2023 +0100 1.2 +++ b/src/cx/linked_list.h Mon Jan 23 20:34:18 2023 +0100 1.3 @@ -63,23 +63,6 @@ 1.4 ) __attribute__((__nonnull__)); 1.5 1.6 /** 1.7 - * Allocates a linked list for storing pointers. 1.8 - * 1.9 - * If you want to store the elements directly in this list, use cxLinkedListCreate(). 1.10 - * 1.11 - * @remark Since only pointers are stored in this list, a possible destructor 1.12 - * MAY free the memory pointed to by its argument in order to prevent memory leaks. 1.13 - * 1.14 - * @param allocator the allocator for allocating the list nodes 1.15 - * @param comparator the comparator for the elements 1.16 - * @return the created list 1.17 - */ 1.18 -CxList *cxPointerLinkedListCreate( 1.19 - CxAllocator const *allocator, 1.20 - CxListComparator comparator 1.21 -) __attribute__((__nonnull__)); 1.22 - 1.23 -/** 1.24 * Finds the node at a certain index. 1.25 * 1.26 * This function can be used to start at an arbitrary position within the list. 1.27 @@ -109,8 +92,6 @@ 1.28 * @param start a pointer to the start node 1.29 * @param loc_advance the location of the pointer to advance 1.30 * @param loc_data the location of the \c data pointer within your node struct 1.31 - * @param follow_ptr \c false if the pointer denoted by \p loc_data shall be passed to the \p cmp_func. 1.32 - * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func. 1.33 * @param cmp_func a compare function to compare \p elem against the node data 1.34 * @param elem a pointer to the element to find 1.35 * @return the index of the element or a past-one index if the element could not be found 1.36 @@ -119,7 +100,6 @@ 1.37 void const *start, 1.38 ptrdiff_t loc_advance, 1.39 ptrdiff_t loc_data, 1.40 - bool follow_ptr, 1.41 CxListComparator cmp_func, 1.42 void const *elem 1.43 ) __attribute__((__nonnull__)); 1.44 @@ -339,20 +319,13 @@ 1.45 /** 1.46 * Sorts a linked list based on a comparison function. 1.47 * 1.48 - * This function can work with linked lists of the following structures: 1.49 + * This function can work with linked lists of the following structure: 1.50 * \code 1.51 * typedef struct node node; 1.52 * struct node { 1.53 * node* prev; 1.54 * node* next; 1.55 - * my_payload data; // in this case set follow_ptr = 0 1.56 - * } 1.57 - * 1.58 - * typedef struct ptr_node ptr_node; 1.59 - * struct ptr_node { 1.60 - * ptr_node* prev; 1.61 - * ptr_node* next; 1.62 - * my_payload* data; // in this case set follow_ptr = 1 1.63 + * my_payload data; 1.64 * } 1.65 * \endcode 1.66 * 1.67 @@ -363,8 +336,6 @@ 1.68 * @param loc_prev the location of a \c prev pointer within your node struct (negative if not present) 1.69 * @param loc_next the location of a \c next pointer within your node struct (required) 1.70 * @param loc_data the location of the \c data pointer within your node struct 1.71 - * @param follow_ptr \c false if the pointer denoted by \p loc_data shall be passed to the \p cmp_func. 1.72 - * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func. 1.73 * @param cmp_func the compare function defining the sort order 1.74 */ 1.75 void cx_linked_list_sort( 1.76 @@ -373,26 +344,19 @@ 1.77 ptrdiff_t loc_prev, 1.78 ptrdiff_t loc_next, 1.79 ptrdiff_t loc_data, 1.80 - bool follow_ptr, 1.81 CxListComparator cmp_func 1.82 -) __attribute__((__nonnull__(1, 7))); 1.83 +) __attribute__((__nonnull__(1, 6))); 1.84 1.85 1.86 /** 1.87 * Compares two lists element wise. 1.88 * 1.89 - * The \c follow_ptr flags have the following meaning: if \c false, the pointer denoted by \p loc_data shall 1.90 - * directly be passed to the \p cmp_func. 1.91 - * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func. 1.92 - * 1.93 * \note Both list must have the same structure. 1.94 * 1.95 * @param begin_left the begin of the left list (\c NULL denotes an empty list) 1.96 * @param begin_right the begin of the right list (\c NULL denotes an empty list) 1.97 * @param loc_advance the location of the pointer to advance 1.98 * @param loc_data the location of the \c data pointer within your node struct 1.99 - * @param follow_ptr_left indicates whether pointers in the left list shall be dereferenced 1.100 - * @param follow_ptr_right indicates whether pointers in the right list shall be dereferenced 1.101 * @param cmp_func the function to compare the elements 1.102 * @return the first non-zero result of invoking \p cmp_func or: negative if the left list is smaller than the 1.103 * right list, positive if the left list is larger than the right list, zero if both lists are equal. 1.104 @@ -402,10 +366,8 @@ 1.105 void const *begin_right, 1.106 ptrdiff_t loc_advance, 1.107 ptrdiff_t loc_data, 1.108 - bool follow_ptr_left, 1.109 - bool follow_ptr_right, 1.110 CxListComparator cmp_func 1.111 -) __attribute__((__nonnull__(7))); 1.112 +) __attribute__((__nonnull__(5))); 1.113 1.114 /** 1.115 * Reverses the order of the nodes in a linked list.