From 3c0ee746d9d2822c1bf04e76267c14785b4d54df Mon Sep 17 00:00:00 2001 From: sanine Date: Tue, 25 Jan 2022 23:07:41 -0600 Subject: add quadtree freeing --- experimental/tectonics/quadtree.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'experimental/tectonics/quadtree.c') 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); +} -- cgit v1.2.1