projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
contrib/docker: add LD_PRELOAD wrapper to fopen/open/opendir syscalls
[collectd.git]
/
src
/
liboconfig
/
parser.y
diff --git
a/src/liboconfig/parser.y
b/src/liboconfig/parser.y
index
d91df8c
..
4a550b3
100644
(file)
--- a/
src/liboconfig/parser.y
+++ b/
src/liboconfig/parser.y
@@
-36,6
+36,7
@@
static int yyerror (const char *s);
/* Lexer variables */
extern int yylineno;
extern char *yytext;
/* Lexer variables */
extern int yylineno;
extern char *yytext;
+extern int yylex (void);
extern oconfig_item_t *ci_root;
extern char *c_file;
extern oconfig_item_t *ci_root;
extern char *c_file;
@@
-207,15
+208,13
@@
statement_list:
entire_file:
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->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;
}
ci_root->children = NULL;
ci_root->children_num = 0;
}
@@
-224,7
+223,7
@@
entire_file:
%%
static int yyerror (const char *s)
{
%%
static int yyerror (const char *s)
{
- char *text;
+ c
onst c
har *text;
if (*yytext == '\n')
text = "<newline>";
if (*yytext == '\n')
text = "<newline>";
@@
-240,7
+239,6
@@
static char *unquote (const char *orig)
{
char *ret = strdup (orig);
int len;
{
char *ret = strdup (orig);
int len;
- int i;
if (ret == NULL)
return (NULL);
if (ret == NULL)
return (NULL);
@@
-254,7
+252,7
@@
static char *unquote (const char *orig)
memmove (ret, ret + 1, len);
ret[len] = '\0';
memmove (ret, ret + 1, len);
ret[len] = '\0';
- for (i = 0; i < len; i++)
+ for (i
nt i
= 0; i < len; i++)
{
if (ret[i] == '\\')
{
{
if (ret[i] == '\\')
{