*: 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
This commit is contained in:
Denis Vlasenko 2008-07-24 23:38:04 +00:00
parent 22f7414843
commit 0f99d49ae6
5 changed files with 57 additions and 106 deletions

View file

@ -66,8 +66,7 @@ parser_t* FAST_FUNC config_open2(const char *filename, FILE* FAST_FUNC (*fopen_f
parser->fp = fopen_func(filename);
if (parser->fp)
return parser;
if (ENABLE_FEATURE_CLEAN_UP)
free(parser);
free(parser);
return NULL;
}
@ -212,6 +211,19 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, unsigned flags, const
if ((flags & (PARSE_DONT_REDUCE|PARSE_DONT_TRIM)) || *line) {
//bb_info_msg("N[%d] T[%s]", ii, line);
tokens[ii++] = line;
// process escapes in token
if (flags & PARSE_ESCAPE) {
char *s = line;
while (*s) {
if (*s == '\\') {
s++;
*line++ = bb_process_escape_sequence((const char **)&s);
} else {
*line++ = *s++;
}
}
*line = '\0';
}
}
line = q;
//bb_info_msg("A[%s]", line);