X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fliboconfig%2Fparser.y;h=1eb7aecee0cade45c59f34a001d110caaa26093e;hb=b81104a423234c04f0eb4ace0ec5e93a363c917a;hp=f0e886cc1a1e28ab5f1c277eb830c54896410d59;hpb=24c2f247f6dc5c17b26d715346a380efababb08f;p=collectd.git diff --git a/src/liboconfig/parser.y b/src/liboconfig/parser.y index f0e886cc..1eb7aece 100644 --- a/src/liboconfig/parser.y +++ b/src/liboconfig/parser.y @@ -208,15 +208,13 @@ statement_list: entire_file: statement_list { - ci_root = malloc (sizeof (oconfig_item_t)); - memset (ci_root, '\0', sizeof (oconfig_item_t)); + ci_root = calloc (1, sizeof (*ci_root)); ci_root->children = $1.statement; ci_root->children_num = $1.statement_num; } | /* epsilon */ { - ci_root = malloc (sizeof (oconfig_item_t)); - memset (ci_root, '\0', sizeof (oconfig_item_t)); + ci_root = calloc (1, sizeof (*ci_root)); ci_root->children = NULL; ci_root->children_num = 0; } @@ -225,7 +223,7 @@ entire_file: %% static int yyerror (const char *s) { - char *text; + const char *text; if (*yytext == '\n') text = "";