[Asterisk-cvs] asterisk pbx.c,1.210,1.211
markster at lists.digium.com
markster at lists.digium.com
Fri Mar 4 23:24:41 CST 2005
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv23850
Modified Files:
pbx.c
Log Message:
Unbreak expression handling from addition of function variables
Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -d -r1.210 -r1.211
--- pbx.c 4 Mar 2005 06:47:23 -0000 1.210
+++ pbx.c 5 Mar 2005 05:21:45 -0000 1.211
@@ -1224,7 +1224,7 @@
int length;
char workspace[4096];
char ltmp[4096], var[4096];
- char *nextvar, *nextexp, *nextfunc;
+ char *nextvar, *nextexp, *nextfunc, *nextthing;
char *vars, *vare;
int pos, brackets, needsub, len, needfunc;
@@ -1234,35 +1234,23 @@
while(!ast_strlen_zero(whereweare) && count) {
/* Assume we're copying the whole remaining string */
pos = strlen(whereweare);
-
- /* Look for a variable */
- nextvar = strstr(whereweare, "${");
-
- /* Look for an expression */
- nextexp = strstr(whereweare, "$[");
-
- /* Look for a function */
- nextfunc = strstr(whereweare, "$(");
-
- /* Pick the first one only */
- len = 0;
- if (nextvar)
- len++;
- if(nextexp)
- len++;
- if(nextfunc)
- len++;
-
- if (len > 1) {
- if(nextfunc) {
- nextvar = nextexp = NULL;
- } else if (nextvar) {
- nextexp = nextfunc = NULL;
- } else if (nextexp) {
- nextvar = nextfunc = NULL;
- }
+ nextvar = NULL;
+ nextexp = NULL;
+ nextfunc = NULL;
+ nextthing = strchr(whereweare, '$');
+ if (nextthing) {
+ switch(nextthing[1]) {
+ case '{':
+ nextvar = nextthing;
+ break;
+ case '[':
+ nextexp = nextthing;
+ break;
+ case '(':
+ nextfunc = nextthing;
+ break;
+ }
}
-
/* If there is one, we only go that far */
if (nextvar)
pos = nextvar - whereweare;
More information about the svn-commits
mailing list