src/cx/linked_list.h

changeset 476
60ff4561dc04
parent 475
31bf97fdbf71
child 477
73a93c7a56ae
equal deleted inserted replaced
475:31bf97fdbf71 476:60ff4561dc04
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
173 * \li \p loc_next and \p begin 173 * \li \p loc_next and \p begin
174 * 174 *
175 * This function returns an adjacent node according to the following rules: 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 * \li if the node has only one adjacent node, that one is returned 176 * to traverse to a former adjacent node in the list.
177 * \li otherwise, the former \c prev node is returned
178 *
179 * \remark The \c next and \c prev pointers of the removed node are cleared by this function.
180 * 177 *
181 * @param begin a pointer to the begin node pointer (optional) 178 * @param begin a pointer to the begin node pointer (optional)
182 * @param end a pointer to the end node pointer (optional) 179 * @param end a pointer to the end node pointer (optional)
183 * @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)
184 * @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)
185 * @param node the node to remove 182 * @param node the node to remove
186 * @return an adjacent node or \c NULL, if this was the last node 183 */
187 */ 184 void cx_linked_list_remove(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *node);
188 void *cx_linked_list_remove(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *node);
189 185
190 186
191 /** 187 /**
192 * Determines the size of a linked list starting with \p node. 188 * Determines the size of a linked list starting with \p node.
193 * @param node the first node 189 * @param node the first node
214 * ptr_node* next; 210 * ptr_node* next;
215 * my_payload* data; // in this case set follow_ptr = 1 211 * my_payload* data; // in this case set follow_ptr = 1
216 * } 212 * }
217 * \endcode 213 * \endcode
218 * 214 *
215 * @note This is a recursive function with at most logarithmic recursion depth.
216 *
219 * @param begin a pointer to the begin node pointer (required) 217 * @param begin a pointer to the begin node pointer (required)
220 * @param end a pointer to the end node pointer (optional) 218 * @param end a pointer to the end node pointer (optional)
221 * @param loc_prev the location of a \c prev pointer within your node struct (negative if not present) 219 * @param loc_prev the location of a \c prev pointer within your node struct (negative if not present)
222 * @param loc_next the location of a \c next pointer within your node struct (required) 220 * @param loc_next the location of a \c next pointer within your node struct (required)
223 * @param loc_data the location of the \c data pointer within your node struct 221 * @param loc_data the location of the \c data pointer within your node struct

mercurial