src/cx/tree.h

branch
feature/tree_add
changeset 863
4a220afebad0
parent 860
558ed4c6abd0
parent 862
387414a7afd8
child 864
7d3061f212cb
--- a/src/cx/tree.h	Sun Jul 07 12:21:58 2024 +0200
+++ b/src/cx/tree.h	Sat Aug 17 11:14:39 2024 +0200
@@ -249,23 +249,26 @@
  * Links a node to a (new) parent.
  *
  * If the node has already a parent, it is unlinked, first.
- * If the parent has children already, the node is \em prepended to the list
+ * If the parent has children already, the node is \em appended to the list
  * of all currently existing children.
  *
  * @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_last_child optional offset in the node struct for the pointer to
+ * the last child in the linked list (negative if there is no such pointer)
  * @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,
-        void * restrict node,
+        void *restrict parent,
+        void *restrict node,
         ptrdiff_t loc_parent,
         ptrdiff_t loc_children,
+        ptrdiff_t loc_last_child,
         ptrdiff_t loc_prev,
         ptrdiff_t loc_next
 );
@@ -278,6 +281,8 @@
  * @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_last_child optional offset in the node struct for the pointer to
+ * the last child in the linked list (negative if there is no such pointer)
  * @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()
@@ -287,6 +292,7 @@
         void *node,
         ptrdiff_t loc_parent,
         ptrdiff_t loc_children,
+        ptrdiff_t loc_last_child,
         ptrdiff_t loc_prev,
         ptrdiff_t loc_next
 );

mercurial