From: Anthony Minessale Date: Fri, 8 Oct 2010 20:59:22 +0000 (-0500) Subject: make parens optional on functions as vars ${foo(bar)} is now the same as ${foo bar} X-Git-Tag: v1.2-rc1~291^2~7^2~8^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdba0e07faafafe90be5336626b1ca8ec8d98bf0;p=thirdparty%2Ffreeswitch.git make parens optional on functions as vars ${foo(bar)} is now the same as ${foo bar} --- diff --git a/src/switch_channel.c b/src/switch_channel.c index 213f385b28..9e76b46a5a 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -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++; diff --git a/src/switch_event.c b/src/switch_event.c index 4b1e28aebf..f782c15900 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -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++;