X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fliboconfig%2Fparser.y;h=4a550b32a1c8e6fa9ad89ec338a1c11c282cd25d;hb=5523a080010dcb7a61dc0dccc3969a2a048e52f9;hp=57e9ddffc770041e134a670897c8036fa001ca6e;hpb=1ebf2f31bd2e080e6f42de640f0a3899a61501c0;p=collectd.git diff --git a/src/liboconfig/parser.y b/src/liboconfig/parser.y index 57e9ddff..4a550b32 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 (*ci_root)); - memset (ci_root, '\0', sizeof (*ci_root)); + ci_root = calloc (1, sizeof (*ci_root)); ci_root->children = $1.statement; ci_root->children_num = $1.statement_num; } | /* epsilon */ { - ci_root = malloc (sizeof (*ci_root)); - memset (ci_root, '\0', sizeof (*ci_root)); + ci_root = calloc (1, sizeof (*ci_root)); ci_root->children = NULL; ci_root->children_num = 0; } @@ -241,7 +239,6 @@ static char *unquote (const char *orig) { char *ret = strdup (orig); int len; - int i; if (ret == NULL) return (NULL); @@ -255,7 +252,7 @@ static char *unquote (const char *orig) memmove (ret, ret + 1, len); ret[len] = '\0'; - for (i = 0; i < len; i++) + for (int i = 0; i < len; i++) { if (ret[i] == '\\') {