From 629cad2c7578aea62761ba2e1810356138b57480 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 4 Apr 2011 19:25:54 -0400 Subject: Don't make empty child arrays when parsing. --- dimension/common.prologue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'dimension/common.prologue') diff --git a/dimension/common.prologue b/dimension/common.prologue index 2830094..649f184 100644 --- a/dimension/common.prologue +++ b/dimension/common.prologue @@ -46,6 +46,22 @@ /* Create a new astnode, populating filename, line, and col */ +static dmnsn_astnode +dmnsn_new_astleaf(dmnsn_astnode_type type, YYLTYPE lloc) +{ + dmnsn_astnode astnode = { + .type = type, + .children = NULL, + .ptr = NULL, + .free_fn = NULL, + .refcount = dmnsn_malloc(sizeof(unsigned int)), + .location = lloc + }; + + *astnode.refcount = 1; + return astnode; +} + static dmnsn_astnode dmnsn_new_astnode(dmnsn_astnode_type type, YYLTYPE lloc) { -- cgit v1.2.3