From c9230a2d9fb5cb7557edaf92cf3acd75d9573bf0 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 23 Jan 2008 11:22:53 +0100 Subject: [PATCH] liboconfig: Allow the argument list of blocks to be empty. This way the `' block doesn't need a bogus argument just to make the parser happy. --- src/liboconfig/parser.y | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/liboconfig/parser.y b/src/liboconfig/parser.y index ea6ed0a0..837b6505 100644 --- a/src/liboconfig/parser.y +++ b/src/liboconfig/parser.y @@ -108,6 +108,12 @@ option: ; block_begin: + OPENBRAC identifier CLOSEBRAC EOL + { + memset (&$$, '\0', sizeof ($$)); + $$.key = $2; + } + | OPENBRAC identifier argument_list CLOSEBRAC EOL { memset (&$$, '\0', sizeof ($$)); @@ -150,7 +156,7 @@ statement_list: statement_list statement { $$ = $1; - if ($2.values_num > 0) + if (($2.values_num > 0) || ($2.children_num > 0)) { $$.statement_num++; $$.statement = realloc ($$.statement, $$.statement_num * sizeof (oconfig_item_t)); @@ -159,7 +165,7 @@ statement_list: } | statement { - if ($1.values_num > 0) + if (($1.values_num > 0) || ($1.children_num > 0)) { $$.statement = malloc (sizeof (oconfig_item_t)); $$.statement[0] = $1; -- 2.30.2