diff options
| author | xXx-caillou-xXx | 2017-12-20 18:09:53 +0100 |
|---|---|---|
| committer | jvoisin | 2017-12-20 18:09:53 +0100 |
| commit | e7f541396715ee2895abcf73044b91ae9b746201 (patch) | |
| tree | ba0e9765e7f14f04b92585df1f3fcd1830ab4b00 /src/sp_tree.c | |
| parent | 8d6cc4f2b63c3f0dc31fe6cecd34ac023ea1cccb (diff) | |
Better parsing of the rules
Thanks to this huge commit from @xXx-caillou-xXx, we can now write amazingly flexible rules.
Diffstat (limited to 'src/sp_tree.c')
| -rw-r--r-- | src/sp_tree.c | 20 |
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 | |||
| 3 | void 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 | |||
| 14 | sp_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 | } | ||
