This helper function simply returns the highest parent of a given
node.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
int walk_tree(const struct quadtree_iterator *iterator);
int walk_tree(const struct quadtree_iterator *iterator);
+
+/* quadtree_find_parent - return the highest parent of the node */
+static inline struct quadtree *quadtree_find_parent(struct quadtree *node)
+{
+ while (node->parent)
+ node = node->parent;
+
+ return node;
+}
+