[svn-commits] mmichelson: branch mmichelson/npm_fixes r180856 - /team/mmichelson/npm_fixes/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 10 14:10:28 CDT 2009


Author: mmichelson
Date: Tue Mar 10 14:10:24 2009
New Revision: 180856

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=180856
Log:
Modify logic for seeing if a match_char is already in the tree.

Prior to this commit, the extensions NNN and _NNN would be detected
as duplicates. This is incorrect since the former is literal while the
latter is a pattern extension.


Modified:
    team/mmichelson/npm_fixes/main/pbx.c

Modified: team/mmichelson/npm_fixes/main/pbx.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/npm_fixes/main/pbx.c?view=diff&rev=180856&r1=180855&r2=180856
==============================================================================
--- team/mmichelson/npm_fixes/main/pbx.c (original)
+++ team/mmichelson/npm_fixes/main/pbx.c Tue Mar 10 14:10:24 2009
@@ -949,7 +949,7 @@
 static void new_find_extension(const char *str, struct scoreboard *score, 
 		struct match_char *tree, int length, int spec, const char *callerid, 
 		const char *label, enum ext_match_t action);
-static struct match_char *already_in_tree(struct match_char *current, char *pat);
+static struct match_char *already_in_tree(struct match_char *current, char *pat, int is_pattern);
 static struct match_char *add_exten_to_pattern_tree(struct ast_context *con, 
 		struct ast_exten *e1, int findonly);
 static struct match_char *add_pattern_node(struct ast_context *con, 
@@ -1764,7 +1764,7 @@
  * where the "|" (or) operator is allowed, I guess, in a way, sort of...
  */
 
-static struct match_char *already_in_tree(struct match_char *current, char *pat)
+static struct match_char *already_in_tree(struct match_char *current, char *pat, int is_pattern)
 {
 	struct match_char *t;
 
@@ -1772,7 +1772,7 @@
 		return 0;
 
 	for (t = current; t; t = t->alt_char) {
-		if (!strcmp(pat, t->x)) /* uh, we may want to sort exploded [] contents to make matching easy */
+		if (is_pattern == t->is_pattern && !strcmp(pat, t->x)) /* uh, we may want to sort exploded [] contents to make matching easy */
 			return t;
 	}
 
@@ -1951,7 +1951,7 @@
 			specif = 1;
 		}
 		m2 = 0;
-		if (already && (m2=already_in_tree(m1,buf)) && m2->next_char) {
+		if (already && (m2=already_in_tree(m1,buf,pattern)) && m2->next_char) {
 			/* XXX MCM - I think it makes sense to check if m2->exten is non-NULL. If it is
 			 * then it means we've found a duplicate extension. In this particular scenario, what
 			 * we do is overwrite what was previously in m2 with what we are now parsing. At least




More information about the svn-commits mailing list