src/cx/tree.h

changeset 862
387414a7afd8
parent 859
6367456bf2d9
child 863
4a220afebad0
--- a/src/cx/tree.h	Sun Jul 07 14:20:28 2024 +0200
+++ b/src/cx/tree.h	Sun Jul 07 14:56:44 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