# HG changeset patch # User Mike Becker # Date 1707942698 -3600 # Node ID e2243453127fe109b6e42430eb649819438e34ba # Parent 5e6f15005efd5238720274af41236ea78b898795 add code documentation for tree functions diff -r 5e6f15005efd -r e2243453127f src/cx/tree.h --- a/src/cx/tree.h Wed Feb 14 21:27:12 2024 +0100 +++ b/src/cx/tree.h Wed Feb 14 21:31:38 2024 +0100 @@ -43,6 +43,19 @@ #endif +/** + * Links a node to a (new) parent. + * + * If the node has already a parent, it is unlinked, first. + * + * @param parent the parent node + * @param node the node that shall be linked + * @param loc_parent offset in the node struct for the parent pointer + * @param loc_children offset in the node struct for the children linked list + * @param loc_prev offset in the node struct for the prev pointer + * @param loc_next offset in the node struct for the next pointer + * @see cx_tree_unlink() + */ __attribute__((__nonnull__)) void cx_tree_link( void * restrict parent, @@ -53,6 +66,18 @@ ptrdiff_t loc_next ); +/** + * Unlinks a node from its parent. + * + * If the node has no parent, this function does nothing. + * + * @param node the node that shall be unlinked from its parent + * @param loc_parent offset in the node struct for the parent pointer + * @param loc_children offset in the node struct for the children linked list + * @param loc_prev offset in the node struct for the prev pointer + * @param loc_next offset in the node struct for the next pointer + * @see cx_tree_link() + */ __attribute__((__nonnull__)) void cx_tree_unlink( void *node,