]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make parens optional on functions as vars ${foo(bar)} is now the same as ${foo bar}
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 8 Oct 2010 20:59:22 +0000 (15:59 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 8 Oct 2010 20:59:22 +0000 (15:59 -0500)
src/switch_channel.c
src/switch_event.c

index 213f385b28c8dffadb33d0df0f4a52b54fa9fe19..9e76b46a5ac95f9c62e854609f1be8700b388843 100644 (file)
@@ -2907,14 +2907,15 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
                                }
                                p = e > endof_indup ? endof_indup : e;
 
-                               if ((vval = strchr(vname, '('))) {
+                               if ((vval = strchr(vname, '(')) || (vval = strchr(vname, ' '))) {
+                                       if (*vval == '(') br = 1;
                                        e = vval - 1;
                                        *vval++ = '\0';
                                        while (*e == ' ') {
                                                *e-- = '\0';
                                        }
                                        e = vval;
-                                       br = 1;
+
                                        while (e && *e) {
                                                if (*e == '(') {
                                                        br++;
index 4b1e28aebf5fd41d2fbf622c165ef7450f248e53..f782c15900504a28b3f31765d351b3b1c06032cc 100644 (file)
@@ -1644,14 +1644,15 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const
                                }
                                p = e > endof_indup ? endof_indup : e;
 
-                               if ((vval = strchr(vname, '('))) {
+                               if ((vval = strchr(vname, '(')) || (vval = strchr(vname, ' '))) {
+                                       if (*vval == '(') br = 1;
                                        e = vval - 1;
                                        *vval++ = '\0';
                                        while (*e == ' ') {
                                                *e-- = '\0';
                                        }
                                        e = vval;
-                                       br = 1;
+
                                        while (e && *e) {
                                                if (*e == '(') {
                                                        br++;