[Freeswitch-svn] [commit] r13287 - in freeswitch/trunk/src: . include
FreeSWITCH SVN
anthm at freeswitch.org
Tue May 12 10:10:57 PDT 2009
Author: anthm
Date: Tue May 12 12:10:57 2009
New Revision: 13287
Log:
accept asterisk N/X/Z/. notation everywhere regexes are expected when they start with _
Modified:
freeswitch/trunk/src/include/switch_utils.h
freeswitch/trunk/src/switch_regex.c
freeswitch/trunk/src/switch_utils.c
Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h (original)
+++ freeswitch/trunk/src/include/switch_utils.h Tue May 12 12:10:57 2009
@@ -514,7 +514,7 @@
SWITCH_DECLARE(const char *) switch_stristr(const char *instr, const char *str);
SWITCH_DECLARE(switch_bool_t) switch_is_lan_addr(const char *ip);
SWITCH_DECLARE(char *) switch_replace_char(char *str, char from, char to, switch_bool_t dup);
-SWITCH_DECLARE(switch_bool_t) switch_ast2regex(char *pat, char *rbuf, size_t len);
+SWITCH_DECLARE(switch_bool_t) switch_ast2regex(const char *pat, char *rbuf, size_t len);
/*!
\brief Escape a string by prefixing a list of characters with an escape character
Modified: freeswitch/trunk/src/switch_regex.c
==============================================================================
--- freeswitch/trunk/src/switch_regex.c (original)
+++ freeswitch/trunk/src/switch_regex.c Tue May 12 12:10:57 2009
@@ -60,11 +60,18 @@
int match_count = 0;
char *tmp = NULL;
uint32_t flags = 0;
+ char abuf[256] = "";
if (!(field && expression)) {
return 0;
}
+ if (*expression == '_') {
+ if (switch_ast2regex(expression + 1, abuf, sizeof(abuf))) {
+ expression = abuf;
+ }
+ }
+
if (*expression == '/') {
char *opts = NULL;
tmp = strdup(expression + 1);
Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c (original)
+++ freeswitch/trunk/src/switch_utils.c Tue May 12 12:10:57 2009
@@ -565,9 +565,9 @@
)? SWITCH_FALSE : SWITCH_TRUE;
}
-SWITCH_DECLARE(switch_bool_t) switch_ast2regex(char *pat, char *rbuf, size_t len)
+SWITCH_DECLARE(switch_bool_t) switch_ast2regex(const char *pat, char *rbuf, size_t len)
{
- char *p = pat;
+ const char *p = pat;
if (!pat) {
return SWITCH_FALSE;
More information about the Freeswitch-svn
mailing list