summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'Parser')
-rw-r--r--Parser/node.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/Parser/node.c b/Parser/node.c
index 86d607a..264fd9e 100644
--- a/Parser/node.c
+++ b/Parser/node.c
@@ -45,3 +45,26 @@ addchild(n1, type, str)
n->n_child = NULL;
return n;
}
+
+static void
+freechildren(n)
+ node *n;
+{
+ int i;
+ for (i = NCH(n); --i >= 0; )
+ freechildren(CHILD(n, i));
+ if (n->n_child != NULL)
+ DEL(n->n_child);
+ if (STR(n) != NULL)
+ DEL(STR(n));
+}
+
+void
+freenode(n)
+ node *n;
+{
+ if (n != NULL) {
+ freechildren(n);
+ DEL(n);
+ }
+}