129 cx_compare_func cmp_func, |
129 cx_compare_func cmp_func, |
130 void const *elem |
130 void const *elem |
131 ) __attribute__((__nonnull__)); |
131 ) __attribute__((__nonnull__)); |
132 |
132 |
133 /** |
133 /** |
|
134 * Finds the node containing an element within a linked list. |
|
135 * |
|
136 * @param result a pointer to the memory where the node pointer (or \c NULL if the element |
|
137 * could not be found) shall be stored to |
|
138 * @param start a pointer to the start node |
|
139 * @param loc_advance the location of the pointer to advance |
|
140 * @param loc_data the location of the \c data pointer within your node struct |
|
141 * @param cmp_func a compare function to compare \p elem against the node data |
|
142 * @param elem a pointer to the element to find |
|
143 * @return the index of the element or a negative value if it could not be found |
|
144 */ |
|
145 ssize_t cx_linked_list_find_node( |
|
146 void **result, |
|
147 void const *start, |
|
148 ptrdiff_t loc_advance, |
|
149 ptrdiff_t loc_data, |
|
150 cx_compare_func cmp_func, |
|
151 void const *elem |
|
152 ) __attribute__((__nonnull__)); |
|
153 |
|
154 /** |
134 * Finds the first node in a linked list. |
155 * Finds the first node in a linked list. |
135 * |
156 * |
136 * The function starts with the pointer denoted by \p node and traverses the list |
157 * The function starts with the pointer denoted by \p node and traverses the list |
137 * along a prev pointer whose location within the node struct is |
158 * along a prev pointer whose location within the node struct is |
138 * denoted by \p loc_prev. |
159 * denoted by \p loc_prev. |