summaryrefslogtreecommitdiff
path: root/src/sp_tree.c
blob: 32394e1241249c715ff7512e2e9ac709f1ca8c34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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(1, sizeof(sp_tree), 1);
  new->next = new->idx = NULL;
  new->value = NULL;
  new->type = UNDEFINED;
  return new;
}