summaryrefslogtreecommitdiff
path: root/libc/misc/internals/parse_config.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-04-17 17:47:08 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-04-17 18:28:33 +0200
commit238d11fd33fe85444fffc0cdd1a07cc70466a686 (patch)
treed1a5241f491afb750d0127345c118fe383467729 /libc/misc/internals/parse_config.c
parent777aef50973bc3a20db8d9545494e8abb86a692e (diff)
parse_config: tweak indentation
and shuffle tokens memsetting around. No obj-code changes. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/misc/internals/parse_config.c')
-rw-r--r--libc/misc/internals/parse_config.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libc/misc/internals/parse_config.c b/libc/misc/internals/parse_config.c
index c17d25553..4d21b5eec 100644
--- a/libc/misc/internals/parse_config.c
+++ b/libc/misc/internals/parse_config.c
@@ -75,8 +75,8 @@ static off_t bb_get_chunk_with_continuation(parser_t* parsr)
else
break;
} else if (parsr->allocated) {
- parsr->line_len += PAGE_SIZE;
- parsr->data = realloc(parsr->data,
+ parsr->line_len += PAGE_SIZE;
+ parsr->data = realloc(parsr->data,
parsr->data_len + parsr->line_len);
parsr->line = parsr->data + parsr->data_len;
} else {
@@ -206,8 +206,6 @@ again:
len = bb_get_chunk_with_continuation(parser);
if (len == -1)
return 0;
- *tokens = (char **) parser->data;
- memset(*tokens, 0, sizeof(*tokens[0]) * ntokens);
line = parser->line;
/* Skip multiple token-delimiters in the start of line? */
@@ -217,6 +215,9 @@ again:
if (line[0] == '\0' || line[0] == delims[0])
goto again;
+ *tokens = (char **) parser->data;
+ memset(*tokens, 0, sizeof(*tokens[0]) * ntokens);
+
/* Tokenize the line */
for (t = 0; *line && *line != delims[0] && t < ntokens; t++) {
/* Pin token */