167 * |
167 * |
168 * If the node to remove is the begin (resp. end) node of the list and if \p begin (resp. \p end) |
168 * If the node to remove is the begin (resp. end) node of the list and if \p begin (resp. \p end) |
169 * addresses are provided, the pointers are adjusted accordingly. |
169 * addresses are provided, the pointers are adjusted accordingly. |
170 * |
170 * |
171 * The following combinations of arguments are valid (more arguments are optional): |
171 * The following combinations of arguments are valid (more arguments are optional): |
172 * \li \p loc_next and \p loc_prev |
172 * \li \p loc_next and \p loc_prev (ancestor node is determined by using the prev pointer, overall O(1) performance) |
173 * \li \p loc_next and \p begin |
173 * \li \p loc_next and \p begin (ancestor node is determined by list traversal, overall O(n) performance) |
174 * |
174 * |
175 * \remark The \c next and \c prev pointers of the removed node are not cleared by this function and may still be used |
175 * \remark The \c next and \c prev pointers of the removed node are not cleared by this function and may still be used |
176 * to traverse to a former adjacent node in the list. |
176 * to traverse to a former adjacent node in the list. |
177 * |
177 * |
178 * @param begin a pointer to the begin node pointer (optional) |
178 * @param begin a pointer to the begin node pointer (optional) |
179 * @param end a pointer to the end node pointer (optional) |
179 * @param end a pointer to the end node pointer (optional) |
180 * @param loc_prev the location of a \c prev pointer within your node struct (negative if your struct does not have one) |
180 * @param loc_prev the location of a \c prev pointer within your node struct (negative if your struct does not have one) |
181 * @param loc_next the location of a \c next pointer within your node struct (required) |
181 * @param loc_next the location of a \c next pointer within your node struct (required) |
182 * @param node the node to remove |
182 * @param node the node to remove |
183 */ |
183 */ |
184 void cx_linked_list_remove(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *node); |
184 void cx_linked_list_remove(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *node) |
|
185 __attribute__ ((nonnull(5))); |
185 |
186 |
186 |
187 |
187 /** |
188 /** |
188 * Determines the size of a linked list starting with \p node. |
189 * Determines the size of a linked list starting with \p node. |
189 * @param node the first node |
190 * @param node the first node |