From e7f541396715ee2895abcf73044b91ae9b746201 Mon Sep 17 00:00:00 2001 From: xXx-caillou-xXx Date: Wed, 20 Dec 2017 18:09:53 +0100 Subject: Better parsing of the rules Thanks to this huge commit from @xXx-caillou-xXx, we can now write amazingly flexible rules.--- src/sp_tree.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/sp_tree.c (limited to 'src/sp_tree.c') 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 @@ +#include "php_snuffleupagus.h" + +void sp_tree_free(sp_tree *tree) { + while (tree) { + sp_tree *tmp; + pefree(tree->value, 1); + sp_tree_free(tree->idx); + tmp = tree; + tree = tree->next; + pefree(tmp, 1); + } +} + +sp_tree *sp_tree_new() { + sp_tree *new = pecalloc(sizeof(sp_tree), 1, 1); + new->next = new->idx = NULL; + new->value = NULL; + new->type = 0; + return new; +} -- cgit v1.3