[asterisk-commits] murf: branch murf/utf8-whatif r90165 - /team/murf/utf8-whatif/main/pbx.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Nov 29 13:43:34 CST 2007
Author: murf
Date: Thu Nov 29 13:43:33 2007
New Revision: 90165
URL: http://svn.digium.com/view/asterisk?view=rev&rev=90165
Log:
Turn off pattern matching for literal chars within a pattern (you know, preceeded by backslash.
Modified:
team/murf/utf8-whatif/main/pbx.c
Modified: team/murf/utf8-whatif/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/utf8-whatif/main/pbx.c?view=diff&rev=90165&r1=90164&r2=90165
==============================================================================
--- team/murf/utf8-whatif/main/pbx.c (original)
+++ team/murf/utf8-whatif/main/pbx.c Thu Nov 29 13:43:33 2007
@@ -1026,13 +1026,17 @@
int utf8_err = 0;
ucs4_t curr_char = ast_utf8_to_ucs4((char *)str, &next, &utf8_err);
ucs4_t next_char = ast_utf8_to_ucs4(next, &next2, &utf8_err);
-
+
#ifdef DEBUG_THIS
+ char tbuf[1024];
if (tree)
- ast_log(LOG_NOTICE,"new_find_extension called with %s on (sub)tree %s\n", str, tree->x);
- else
+ {
+ ast_ucs4_to_utf8(tree->x, tbuf, sizeof(tbuf), 0);
+ ast_log(LOG_NOTICE,"new_find_extension called with %s on (sub)tree %s\n", str, tbuf);
+ } else
ast_log(LOG_NOTICE,"new_find_extension called with %s on (sub)tree NULL\n", str);
#endif
+
for (p=tree; p; p=p->alt_char) {
if (p->is_pattern && p->x[0] == 'N' && p->x[1] == 0 && curr_char >= '2' && curr_char <= '9' ) {
if (p->exten && !(next_char))
@@ -1262,6 +1266,7 @@
struct match_char *m1=0,*m2=0;
int specif;
int already;
+ int literal = 0;
int pattern = 0;
char extenbuf[512];
ucs4_t buf[256];
@@ -1292,6 +1297,7 @@
s1 = next_char;
}
while( *s1 ) {
+ literal = 0;
curr_char = ast_utf8_to_ucs4(s1, &next_char, &error);
if (pattern && curr_char == '[' && *(s1-1) != '\\') {
ucs4_t *s2 = buf;
@@ -1340,6 +1346,7 @@
if (curr_char == '\\') {
curr_char = ast_utf8_to_ucs4(next_char, &next_char, &error);
buf[0] = curr_char;
+ literal = 1;
s1 = next_char;
} else {
if (pattern) {
@@ -1375,7 +1382,7 @@
} else {
if (findonly)
return m1;
- m1 = add_pattern_node(con, m1, mcr_list, buf, pattern, already,specif); /* m1 is the node just added */
+ m1 = add_pattern_node(con, m1, mcr_list, buf, pattern && !literal, already,specif); /* m1 is the node just added */
mcr_list = 0; /* it's now hanging off the newly created node */
}
@@ -1429,6 +1436,8 @@
pattern_tree->exten = 0; /* never hurts to make sure there's no pointers laying around */
if (pattern_tree->x)
free(pattern_tree->x);
+ if (pattern_tree->mcr)
+ destroy_range_list(pattern_tree->mcr);
free(pattern_tree);
}
More information about the asterisk-commits
mailing list