[Asterisk-code-review] config: Allow filters when appending to a category (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Mon Apr 4 18:40:36 CDT 2016


Richard Mudgett has posted comments on this change.

Change subject: config:  Allow filters when appending to a category
......................................................................


Patch Set 1: Code-Review-1

(2 comments)

https://gerrit.asterisk.org/#/c/2487/1/main/config.c
File main/config.c:

Line 796: 	while ((nvp = ast_strsep2(&dupmatch, ",&", AST_STRSEP_STRIP))) {
You need to pass in a filter separator of '&' or ',' depending upon who is calling.  You are altering the syntax accepted by other users like AMI actions which already expect filters to be separated by commas.

ast_category_get_sep() needs to be extracted out of ast_category_get()

struct ast_category *ast_category_get_sep(const struct ast_config *config, const char *category_name, const char *filter, char filter_sep)
{
  previous contents of ast_category_get()
  to call does_category_match() that now takes filter_sep
}


struct ast_category *ast_category_get(const struct ast_config *config, const char *category_name, const char *filter)
{
  ast_category_get_sep(config, category_name, filter, ',')
}

With this change you don't need ast_strsep2().

ast_strsep2() here makes commas and ampersands equivalent syntax wise.  Thus you could have var=value,var2=value2&var3=value3 which is odd being able to switch separators like that.


Line 1695: 					*cat = ast_category_get(cfg, catname, filter);
Make call ast_category_get_sep() with filter_sep of '&' described above.


-- 
To view, visit https://gerrit.asterisk.org/2487
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I10773da4c79db36fbf1993961992af63d3441580
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list