summaryrefslogtreecommitdiffstats
path: root/dimension/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-03-23 17:35:53 -0400
committerTavian Barnes <tavianator@gmail.com>2010-03-23 17:48:37 -0400
commite51389d68ef2e152054d987d7a99930bce180954 (patch)
tree78a59584f7e640e0d077a5d887305e3b5fdba060 /dimension/parse.c
parent1d441aea4446484342f93fbf315f7f70de8adaf7 (diff)
downloaddimension-e51389d68ef2e152054d987d7a99930bce180954.tar.xz
Implement macro support.
Diffstat (limited to 'dimension/parse.c')
-rw-r--r--dimension/parse.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/dimension/parse.c b/dimension/parse.c
index 4008fcf..c568271 100644
--- a/dimension/parse.c
+++ b/dimension/parse.c
@@ -338,6 +338,7 @@ dmnsn_new_astnode(dmnsn_astnode_type type)
.type = type,
.children = NULL,
.ptr = NULL,
+ .free_fn = NULL,
.refcount = malloc(sizeof(unsigned int)),
.filename = "<environment>",
.line = -1,
@@ -479,7 +480,11 @@ dmnsn_delete_astnode(dmnsn_astnode astnode)
{
if (*astnode.refcount <= 1) {
dmnsn_delete_astree(astnode.children);
- free(astnode.ptr);
+ if (astnode.free_fn) {
+ (*astnode.free_fn)(astnode.ptr);
+ } else {
+ free(astnode.ptr);
+ }
free(astnode.refcount);
} else {
--*astnode.refcount;