From bd8dcb97354bc29050e5aefe957c651bf2fedd07 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 3 Apr 2012 01:27:27 +0200 Subject: Keep list of strings allocated by the lexer --- src/config.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/config.c') diff --git a/src/config.c b/src/config.c index 964c2d6..7c1b62f 100644 --- a/src/config.c +++ b/src/config.c @@ -183,13 +183,22 @@ void fastd_read_config(fastd_context *ctx, fastd_config *conf, const char *filen else token = START_CONFIG; + fastd_config_str *strings = NULL; + while(fastd_config_push_parse(ps, token, &token_val, &loc, ctx, conf, filename, depth+1) == YYPUSH_MORE) { token = fastd_config_yylex(&token_val, &loc, scanner); if (token < 0) - exit_error(ctx, "config error: %s at %s:%i:%i", token_val.str, filename, loc.first_line, loc.first_column); + exit_error(ctx, "config error: %s at %s:%i:%i", token_val.error, filename, loc.first_line, loc.first_column); + + if (token == TOK_STRING) { + token_val.str->next = strings; + strings = token_val.str; + } } + fastd_config_str_free(strings); + fastd_config_pstate_delete(ps); fastd_config_yylex_destroy(scanner); -- cgit v1.2.3