chiark / gitweb /
Finalise 0.6.2
[secnet.git] / conffile.y
index 1a8ef364a215567579bbf5fb230d0bf75b5ce0fd..2d08847e002c3145c1bbcaea6e734f27fd058832 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * This file is part of secnet.
+ * See LICENCE and this file CREDITS for full list of copyright holders.
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ * There is NO WARRANTY.
+ */
+
 %token TOK_STRING
 %token TOK_NUMBER
 %token TOK_KEY
@@ -8,8 +15,15 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+/* Bison stupidly redeclares malloc/free unless they are #defined
+ * (or a bunch of madder conditions) */
+#ifndef malloc
+# define malloc malloc
+# define free free
+#endif
 #include "secnet.h"
 #include "conffile_internal.h"
+#include "conffile.yy.h"
 #include "util.h"
 #define YYERROR_VERBOSE
 
@@ -96,7 +110,7 @@ static struct p_node *node(uint32_t type, struct p_node *l, struct p_node *r)
 {
        struct p_node *rv;
 
-       rv=safe_malloc(sizeof(*rv),"p_node");
+       NEW(rv);
        rv->type=type;
        rv->loc.file=config_file;
        rv->loc.line=config_lineno;