summaryrefslogtreecommitdiff
path: root/experimental/tectonics/quadtree.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-01-25 23:07:41 -0600
committersanine <sanine.not@pm.me>2022-01-25 23:07:41 -0600
commit3c0ee746d9d2822c1bf04e76267c14785b4d54df (patch)
tree07df48552bdc9a6c18743d185bbe4539458465a9 /experimental/tectonics/quadtree.c
parent008cf63a05d7be6ed165747ec5e735e002de3b2d (diff)
add quadtree freeing
Diffstat (limited to 'experimental/tectonics/quadtree.c')
-rw-r--r--experimental/tectonics/quadtree.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/experimental/tectonics/quadtree.c b/experimental/tectonics/quadtree.c
index dead9f2..0f3f9c7 100644
--- a/experimental/tectonics/quadtree.c
+++ b/experimental/tectonics/quadtree.c
@@ -133,3 +133,16 @@ void draw_quadtree(cairo_t *cr, struct quadtree_node_t *node)
draw_quadtree(cr, node->se);
}
}
+
+
+void free_tree(struct quadtree_node_t *node)
+{
+ if (node->nw != NULL) {
+ free_tree(node->nw);
+ free_tree(node->ne);
+ free_tree(node->sw);
+ free_tree(node->se);
+ }
+
+ free(node);
+}