While we're at it, split the function into two so that the parser
doesn't have to call the exported version.
}
}
-void cdecl_free(struct cdecl *decl)
+static void free_decl(struct cdecl *decl)
{
free_declspec(decl->specifiers);
free_declarator(decl->declarators);
free(decl);
}
+
+void cdecl_free(struct cdecl *decl)
+{
+ if (decl)
+ free_decl(decl);
+}
%}
%destructor { free($$); } <strval>
%destructor { free_declspec($$); } <declspec>
%destructor { free_declarator($$); } <declarator>
-%destructor { cdecl_free($$); } <decl>
+%destructor { free_decl($$); } <decl>
%token T_LEX_ERROR