[Freeswitch-svn] [commit] r11352 - in freeswitch/trunk/src: . include
FreeSWITCH SVN
anthm at freeswitch.org
Wed Jan 21 19:42:22 PST 2009
Author: anthm
Date: Wed Jan 21 21:42:22 2009
New Revision: 11352
Log:
beastie
Modified:
freeswitch/trunk/src/include/switch_utils.h
freeswitch/trunk/src/switch_caller.c
freeswitch/trunk/src/switch_channel.c
Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h (original)
+++ freeswitch/trunk/src/include/switch_utils.h Wed Jan 21 21:42:22 2009
@@ -305,6 +305,31 @@
}
+static inline switch_bool_t switch_string_var_check_const(const char *s)
+{
+ const char *p;
+ int dol = 0;
+
+ for (p = s; p && *p; p++) {
+ if (*p == '$') {
+ dol = 1;
+ } else if (dol) {
+ if (*p == '{') {
+ return SWITCH_TRUE;
+ } else if (*p != '\\') {
+ dol = 0;
+ }
+ }
+ }
+ return SWITCH_FALSE;
+}
+
+static inline char *switch_var_clean_string(char *s)
+{
+ switch_string_var_check(s, SWITCH_TRUE);
+ return s;
+}
+
static inline char *switch_clean_string(char *s)
{
char *p;
Modified: freeswitch/trunk/src/switch_caller.c
==============================================================================
--- freeswitch/trunk/src/switch_caller.c (original)
+++ freeswitch/trunk/src/switch_caller.c Wed Jan 21 21:42:22 2009
@@ -34,7 +34,7 @@
#include <switch_caller.h>
#define profile_dup(a,b,p) if (!switch_strlen_zero(a)) { b = switch_core_strdup(p, a); } else { b = SWITCH_BLANK_STRING; }
-#define profile_dup_clean(a,b,p) if (!switch_strlen_zero(a)) { b = switch_clean_string(switch_core_strdup(p, a)); switch_string_var_check( (char *) b , SWITCH_TRUE);} else { b = SWITCH_BLANK_STRING; }
+#define profile_dup_clean(a,b,p) if (!switch_strlen_zero(a)) { b = switch_var_clean_string(switch_clean_string(switch_core_strdup(p, a)));} else { b = SWITCH_BLANK_STRING; }
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool,
const char *username,
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Wed Jan 21 21:42:22 2009
@@ -584,9 +584,9 @@
switch_event_del_header(channel->variables, varname);
if (!switch_strlen_zero(value)) {
int ok = 1;
-
+
if (var_check) {
- ok = !switch_string_var_check((char *)value, SWITCH_FALSE);
+ ok = !switch_string_var_check_const(value);
}
if (ok) {
switch_event_add_header_string(channel->variables, SWITCH_STACK_BOTTOM, varname, value);
More information about the Freeswitch-svn
mailing list