summaryrefslogtreecommitdiff
path: root/src/sp_tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp_tree.c')
-rw-r--r--src/sp_tree.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sp_tree.c b/src/sp_tree.c
new file mode 100644
index 0000000..328a919
--- /dev/null
+++ b/src/sp_tree.c
@@ -0,0 +1,20 @@
1#include "php_snuffleupagus.h"
2
3void sp_tree_free(sp_tree *tree) {
4 while (tree) {
5 sp_tree *tmp;
6 pefree(tree->value, 1);
7 sp_tree_free(tree->idx);
8 tmp = tree;
9 tree = tree->next;
10 pefree(tmp, 1);
11 }
12}
13
14sp_tree *sp_tree_new() {
15 sp_tree *new = pecalloc(sizeof(sp_tree), 1, 1);
16 new->next = new->idx = NULL;
17 new->value = NULL;
18 new->type = 0;
19 return new;
20}