diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-10-10 11:28:46 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-10-10 16:45:11 +0200 |
commit | 24c90b7700e18d0668799f8f343bc854a42dea20 (patch) | |
tree | 224d9b5e81a46e27f354c6975fc3fa4cd1f1fb79 /cmd | |
parent | 7b647eefef00afb6104e84fae2a2fbf0481d4364 (diff) |
Configuration parser cleanup
- Do a getline() & process in rdline instead of doing a read per character
and feeding it through a state machine.
- Move splitkv to rdcfg.c, the only place where it is used
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/runsvc/env.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/runsvc/env.c b/cmd/runsvc/env.c index 4fe2368..1e73ee4 100644 --- a/cmd/runsvc/env.c +++ b/cmd/runsvc/env.c @@ -41,7 +41,7 @@ static struct entry *parse_list(rdline_t *rd) char *ptr; while (rdline(rd) == 0) { - ptr = rd->buffer; + ptr = rd->line; while (*ptr != '\0' && *ptr != ' ' && *ptr != '=') ++ptr; @@ -66,11 +66,11 @@ static struct entry *parse_list(rdline_t *rd) continue; } - e = calloc(1, sizeof(*e) + strlen(rd->buffer) + 1); + e = calloc(1, sizeof(*e) + strlen(rd->line) + 1); if (e == NULL) goto fail_oom; - strcpy(e->data, rd->buffer); + strcpy(e->data, rd->line); e->next = list; list = e; } |