diff options
author | Jenkins2 <jenkins2@gerrit.asterisk.org> | 2017-12-04 08:52:45 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-12-04 08:52:45 -0600 |
commit | 7e4bd0cf6910500bb962b6d16fff42a739d8b961 (patch) | |
tree | 6c1929572a76b9706b2d8d753c1115ba9a123202 /main | |
parent | 9e9dccd293301ff0b26fb1ae0c88f4fa23db41cd (diff) | |
parent | 6635ddc819854d0a89667a00983ed848d224730b (diff) |
Merge "config: Speed up config template lookup" into 13
Diffstat (limited to 'main')
-rw-r--r-- | main/config.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/main/config.c b/main/config.c index 9be758173..e686c23b4 100644 --- a/main/config.c +++ b/main/config.c @@ -988,13 +988,15 @@ struct ast_category *ast_category_new_template(const char *name, const char *in_ } static struct ast_category *category_get_sep(const struct ast_config *config, - const char *category_name, const char *filter, char sep) + const char *category_name, const char *filter, char sep, char pointer_match_possible) { struct ast_category *cat; - for (cat = config->root; cat; cat = cat->next) { - if (cat->name == category_name && does_category_match(cat, category_name, filter, sep)) { - return cat; + if (pointer_match_possible) { + for (cat = config->root; cat; cat = cat->next) { + if (cat->name == category_name && does_category_match(cat, category_name, filter, sep)) { + return cat; + } } } @@ -1010,7 +1012,7 @@ static struct ast_category *category_get_sep(const struct ast_config *config, struct ast_category *ast_category_get(const struct ast_config *config, const char *category_name, const char *filter) { - return category_get_sep(config, category_name, filter, ','); + return category_get_sep(config, category_name, filter, ',', 1); } const char *ast_category_get_name(const struct ast_category *category) @@ -1794,7 +1796,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat, if (cur[1] != ',') { filter = &cur[1]; } - *cat = category_get_sep(cfg, catname, filter, '&'); + *cat = category_get_sep(cfg, catname, filter, '&', 0); if (!(*cat)) { if (newcat) { ast_category_destroy(newcat); @@ -1812,7 +1814,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat, } else { struct ast_category *base; - base = ast_category_get(cfg, cur, "TEMPLATES=include"); + base = category_get_sep(cfg, cur, "TEMPLATES=include", ',', 0); if (!base) { if (newcat) { ast_category_destroy(newcat); |