[Freeswitch-svn] [commit] r5979 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Thu Oct 18 17:36:57 EDT 2007


Author: anthm
Date: Thu Oct 18 17:36:57 2007
New Revision: 5979

Modified:
   freeswitch/trunk/src/switch_channel.c

Log:
change var parser to ${func(arg)}

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Thu Oct 18 17:36:57 2007
@@ -1301,9 +1301,10 @@
 
 			if (*p == '$' && !nv) {
 				if (*(p+1)) {
-					vtype = 1;
-					if (*(p + 1) != '{') {
-						vtype = 2;
+					if (*(p+1) == '{') {
+						vtype = 1;
+					} else {
+						nv = 1;
 					}
 				} else {
 					nv = 1;
@@ -1331,31 +1332,26 @@
 				e = s;
 				vname = s;
 				while (*e) {
-					if (!br && *e == ' ') {
-						*e++ = '\0';
-						sp++;
-						break;
-					}
 					if (br == 1 && *e == '}') {
 						br = 0;
 						*e++ = '\0';
 						break;
 					}
-					if (vtype == 2) {
-						if (*e == '(') {
-							*e++ = '\0';
-							vval = e;
-							br = 2;
-						}
-						if (br == 2 && *e == ')') {
-							*e++ = '\0';
-							br = 0;
-							break;
-						}
-					}
 					e++;
 				}
 				p = e;
+				
+				if ((vval = strchr(vname, '('))) {
+					e = vval - 1;
+					*vval++ = '\0';
+					while(*e == ' ') {
+						*e-- = '\0';
+					}
+					if ((e = strchr(vval, ')'))) {
+						*e = '\0';
+					}
+					vtype = 2;
+				}
 
 				if (vtype == 1) {
 					sub_val = switch_channel_get_variable(channel, vname);



More information about the Freeswitch-svn mailing list