41 #ifdef __cplusplus |
41 #ifdef __cplusplus |
42 extern "C" { |
42 extern "C" { |
43 #endif |
43 #endif |
44 |
44 |
45 |
45 |
|
46 /** |
|
47 * Links a node to a (new) parent. |
|
48 * |
|
49 * If the node has already a parent, it is unlinked, first. |
|
50 * |
|
51 * @param parent the parent node |
|
52 * @param node the node that shall be linked |
|
53 * @param loc_parent offset in the node struct for the parent pointer |
|
54 * @param loc_children offset in the node struct for the children linked list |
|
55 * @param loc_prev offset in the node struct for the prev pointer |
|
56 * @param loc_next offset in the node struct for the next pointer |
|
57 * @see cx_tree_unlink() |
|
58 */ |
46 __attribute__((__nonnull__)) |
59 __attribute__((__nonnull__)) |
47 void cx_tree_link( |
60 void cx_tree_link( |
48 void * restrict parent, |
61 void * restrict parent, |
49 void * restrict node, |
62 void * restrict node, |
50 ptrdiff_t loc_parent, |
63 ptrdiff_t loc_parent, |
51 ptrdiff_t loc_children, |
64 ptrdiff_t loc_children, |
52 ptrdiff_t loc_prev, |
65 ptrdiff_t loc_prev, |
53 ptrdiff_t loc_next |
66 ptrdiff_t loc_next |
54 ); |
67 ); |
55 |
68 |
|
69 /** |
|
70 * Unlinks a node from its parent. |
|
71 * |
|
72 * If the node has no parent, this function does nothing. |
|
73 * |
|
74 * @param node the node that shall be unlinked from its parent |
|
75 * @param loc_parent offset in the node struct for the parent pointer |
|
76 * @param loc_children offset in the node struct for the children linked list |
|
77 * @param loc_prev offset in the node struct for the prev pointer |
|
78 * @param loc_next offset in the node struct for the next pointer |
|
79 * @see cx_tree_link() |
|
80 */ |
56 __attribute__((__nonnull__)) |
81 __attribute__((__nonnull__)) |
57 void cx_tree_unlink( |
82 void cx_tree_unlink( |
58 void *node, |
83 void *node, |
59 ptrdiff_t loc_parent, |
84 ptrdiff_t loc_parent, |
60 ptrdiff_t loc_children, |
85 ptrdiff_t loc_children, |