From f29c9888ca10dcd11355aa3db1645e3a8fc1c97b Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Fri, 8 Jul 2011 13:03:21 +0300 Subject: [PATCH] quadtree: Move quadtree_recalculate_parent_stats() out from the header This function is not called anywhere outside of the quadtree.c, so there is no really point in keeping it in the header. Furthermore, this is one quite big function to keep inlined. Make it an ordinary static function instead and let the compiler decide whether it should be inlined or not. Signed-off-by: Timo Kokkonen --- quadtree.c | 29 +++++++++++++++++++++++++++++ quadtree.h | 29 ----------------------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/quadtree.c b/quadtree.c index 60ecd6d..1417c54 100644 --- a/quadtree.c +++ b/quadtree.c @@ -189,6 +189,35 @@ static struct quadtree *_quadtree_add(struct quadtree *parent, return new; } +/* + * Recursively walk through the tree and propagate changes made to the + * given node up until the highest parent. + */ +static void quadtree_recalculate_parent_stats(struct quadtree *node, + struct quadtree_ops *ops) +{ + int i; + + while (node) { + node->depth = 0; + node->children = 0; + + for (i = 0; i < 4; i++) { + if (!node->child[i]) + continue; + + node->depth = MAX(node->depth, + node->child[i]->depth + 1); + node->children += node->child[i]->children + 1; + } + + if (ops->recalculate_stats) + ops->recalculate_stats(node); + + node = node->parent; + } +} + /** * quadtree_add - add a node to a quadtree * @parent: parent node diff --git a/quadtree.h b/quadtree.h index 45478fa..f69f34d 100644 --- a/quadtree.h +++ b/quadtree.h @@ -70,33 +70,4 @@ static inline struct quadtree *quadtree_find_parent(const struct quadtree *node) return t; } -/* - * Recursively walk through the tree and propagate changes made to the - * given node up until the highest parent. - */ -static inline void quadtree_recalculate_parent_stats(struct quadtree *node, - struct quadtree_ops *ops) -{ - int i; - - while (node) { - node->depth = 0; - node->children = 0; - - for (i = 0; i < 4; i++) { - if (!node->child[i]) - continue; - - node->depth = MAX(node->depth, - node->child[i]->depth + 1); - node->children += node->child[i]->children + 1; - } - - if (ops->recalculate_stats) - ops->recalculate_stats(node); - - node = node->parent; - } -} - #endif -- 2.44.0