diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-24 23:38:04 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-24 23:38:04 +0000 |
commit | 0f99d49ae680e675809428deace3c4fe839d323c (patch) | |
tree | 712afab828ee4fb02493bc60e1a37f1142231263 /libbb/parse_config.c | |
parent | 22f741484391c3b2fd94881fd41c8c0df9749e95 (diff) | |
download | busybox-w32-0f99d49ae680e675809428deace3c4fe839d323c.tar.gz busybox-w32-0f99d49ae680e675809428deace3c4fe839d323c.tar.bz2 busybox-w32-0f99d49ae680e675809428deace3c4fe839d323c.zip |
*: conversion to config parser
function old new delta
config_read 540 597 +57
config_open2 41 44 +3
rtnl_rtprot_initialize 70 66 -4
rtnl_rttable_initialize 78 73 -5
rtnl_rtscope_initialize 88 83 -5
rtnl_rtrealm_initialize 48 43 -5
rtnl_rtdsfield_initialize 48 43 -5
process_module 566 560 -6
bbunpack 391 383 -8
rtnl_tab_initialize 279 121 -158
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/8 up/down: 60/-196) Total: -136 bytes
Diffstat (limited to 'libbb/parse_config.c')
-rw-r--r-- | libbb/parse_config.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libbb/parse_config.c b/libbb/parse_config.c index d1b29218b..83dc997f6 100644 --- a/libbb/parse_config.c +++ b/libbb/parse_config.c | |||
@@ -66,8 +66,7 @@ parser_t* FAST_FUNC config_open2(const char *filename, FILE* FAST_FUNC (*fopen_f | |||
66 | parser->fp = fopen_func(filename); | 66 | parser->fp = fopen_func(filename); |
67 | if (parser->fp) | 67 | if (parser->fp) |
68 | return parser; | 68 | return parser; |
69 | if (ENABLE_FEATURE_CLEAN_UP) | 69 | free(parser); |
70 | free(parser); | ||
71 | return NULL; | 70 | return NULL; |
72 | } | 71 | } |
73 | 72 | ||
@@ -212,6 +211,19 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, unsigned flags, const | |||
212 | if ((flags & (PARSE_DONT_REDUCE|PARSE_DONT_TRIM)) || *line) { | 211 | if ((flags & (PARSE_DONT_REDUCE|PARSE_DONT_TRIM)) || *line) { |
213 | //bb_info_msg("N[%d] T[%s]", ii, line); | 212 | //bb_info_msg("N[%d] T[%s]", ii, line); |
214 | tokens[ii++] = line; | 213 | tokens[ii++] = line; |
214 | // process escapes in token | ||
215 | if (flags & PARSE_ESCAPE) { | ||
216 | char *s = line; | ||
217 | while (*s) { | ||
218 | if (*s == '\\') { | ||
219 | s++; | ||
220 | *line++ = bb_process_escape_sequence((const char **)&s); | ||
221 | } else { | ||
222 | *line++ = *s++; | ||
223 | } | ||
224 | } | ||
225 | *line = '\0'; | ||
226 | } | ||
215 | } | 227 | } |
216 | line = q; | 228 | line = q; |
217 | //bb_info_msg("A[%s]", line); | 229 | //bb_info_msg("A[%s]", line); |