make parens optional on functions as vars ${foo(bar)} is now the same as ${foo bar}

This commit is contained in:
Anthony Minessale 2010-10-08 15:59:22 -05:00
parent f13fa0c1a5
commit fdba0e07fa
2 changed files with 6 additions and 4 deletions

View File

@ -2907,14 +2907,15 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
} }
p = e > endof_indup ? endof_indup : e; 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; e = vval - 1;
*vval++ = '\0'; *vval++ = '\0';
while (*e == ' ') { while (*e == ' ') {
*e-- = '\0'; *e-- = '\0';
} }
e = vval; e = vval;
br = 1;
while (e && *e) { while (e && *e) {
if (*e == '(') { if (*e == '(') {
br++; br++;

View File

@ -1644,14 +1644,15 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const
} }
p = e > endof_indup ? endof_indup : e; 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; e = vval - 1;
*vval++ = '\0'; *vval++ = '\0';
while (*e == ' ') { while (*e == ' ') {
*e-- = '\0'; *e-- = '\0';
} }
e = vval; e = vval;
br = 1;
while (e && *e) { while (e && *e) {
if (*e == '(') { if (*e == '(') {
br++; br++;