summaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-04-03 01:27:27 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-04-03 01:27:27 +0200
commitbd8dcb97354bc29050e5aefe957c651bf2fedd07 (patch)
treea2136790e88df12a0a7607811c02fc05f3413e2c /src/config.c
parenta25640e3b49e7abdf8930d9439a85d066b5235f2 (diff)
downloadfastd-bd8dcb97354bc29050e5aefe957c651bf2fedd07.tar
fastd-bd8dcb97354bc29050e5aefe957c651bf2fedd07.zip
Keep list of strings allocated by the lexer
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c11
1 files changed, 10 insertions, 1 deletions
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);