X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fliboconfig%2Fparser.y;h=5d7b98dfc7e63b7f828de38f7d948a226149450d;hb=56688f815d42e6aa3e52b5c419ef643a8ebae712;hp=ea6ed0a099a2a822bd119dc6c16ebadcad594c25;hpb=06adec208286b5a136ffa5c5f3832c35e9f62844;p=collectd.git diff --git a/src/liboconfig/parser.y b/src/liboconfig/parser.y index ea6ed0a0..5d7b98df 100644 --- a/src/liboconfig/parser.y +++ b/src/liboconfig/parser.y @@ -1,6 +1,6 @@ /** * oconfig - src/parser.y - * Copyright (C) 2007 Florian octo Forster + * Copyright (C) 2007,2008 Florian octo Forster * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -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;