Simplify error node
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 16 Apr 2013 13:53:49 +0000 (09:53 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 16 Apr 2013 13:53:49 +0000 (09:53 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/metadata/ctf-parser.y

index 5d2415c7d6a03c47b841d451c808fd719b9fc9f6..40cf65e9a03605922d631a83bcb7b0bc49dccdd1 100644 (file)
@@ -83,8 +83,12 @@ static const char *node_type_to_str[] = {
 #undef ENTRY
 };
 
-/* Static node for out of memory errors */
-static __thread struct ctf_node error_node = {
+/*
+ * Static node for out of memory errors. Only "type" is used. lineno is
+ * always left at 0. The rest of the node content can be overwritten,
+ * but is never used.
+ */
+static struct ctf_node error_node = {
        .type = NODE_ERROR,
 };
 
@@ -333,8 +337,7 @@ static struct ctf_node *make_node(struct ctf_scanner *scanner,
 
        node = malloc(sizeof(*node));
        if (!node) {
-               error_node.lineno = yyget_lineno(scanner->scanner);
-               printfl_fatal(error_node.lineno, "out of memory");
+               printfl_fatal(yyget_lineno(scanner->scanner), "out of memory");
                return &error_node;
        }
        memset(node, 0, sizeof(*node));
This page took 0.026767 seconds and 4 git commands to generate.