[asterisk-commits] trunk r23782 - in /trunk/pbx/ael: ael.flex ael_lex.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Apr 30 16:31:44 MST 2006


Author: rizzo
Date: Sun Apr 30 18:31:43 2006
New Revision: 23782

URL: http://svn.digium.com/view/asterisk?rev=23782&view=rev
Log:
put back some simplifications, this time really tested
(ael_lex.c manually deleted, runtest passed)


Modified:
    trunk/pbx/ael/ael.flex
    trunk/pbx/ael/ael_lex.c

Modified: trunk/pbx/ael/ael.flex
URL: http://svn.digium.com/view/asterisk/trunk/pbx/ael/ael.flex?rev=23782&r1=23781&r2=23782&view=diff
==============================================================================
--- trunk/pbx/ael/ael.flex (original)
+++ trunk/pbx/ael/ael.flex Sun Apr 30 18:31:43 2006
@@ -240,7 +240,7 @@
 		} else {
 			STORE_LOC;
 			yylval->str = strdup(yytext);
-			yylval->str[strlen(yylval->str)-1] = '\0'; /* trim trailing ')' */
+			yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
 			unput(')');
 			BEGIN(0);
 			return word;
@@ -290,19 +290,13 @@
 			yymore();
 		} else {
 			STORE_LOC;
-			yylval->str = strdup(yytext);
-			if(yyleng > 1 )
-				yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
-			BEGIN(0);
-			if ( !strcmp(yylval->str,")") ) {
-				free(yylval->str);
-				yylval->str = 0;
-				my_col++; /* XXX why ? */
+			BEGIN(0);
+			if ( !strcmp(yytext, ")") )
 				return RP;
-			} else {
-				unput(')');
-				return word;
-			}
+			yylval->str = strdup(yytext);
+			yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
+			unput(')');
+			return word;
 		}
 	}
 
@@ -321,8 +315,7 @@
 				/* printf("Got argg2 word %s\n", yylval->str); */
 				unput(',');
 				commaout = 1;
-				if (yyleng > 1 )
-					*(yylval->str+yyleng-1)=0;
+				yylval->str[yyleng-1] = '\0';
 				return word;
 			} else {
 				commaout = 0;

Modified: trunk/pbx/ael/ael_lex.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/ael/ael_lex.c?rev=23782&r1=23781&r2=23782&view=diff
==============================================================================
--- trunk/pbx/ael/ael_lex.c (original)
+++ trunk/pbx/ael/ael_lex.c Sun Apr 30 18:31:43 2006
@@ -1348,7 +1348,7 @@
 		} else {
 			STORE_LOC;
 			yylval->str = strdup(yytext);
-			yylval->str[strlen(yylval->str)-1] = '\0'; /* trim trailing ')' */
+			yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
 			unput(')');
 			BEGIN(0);
 			return word;
@@ -1414,26 +1414,20 @@
 			yymore();
 		} else {
 			STORE_LOC;
+			BEGIN(0);
+			if ( !strcmp(yytext, ")") )
+				return RP;
 			yylval->str = strdup(yytext);
-			if(yyleng > 1 )
-				yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
-			BEGIN(0);
-			if ( !strcmp(yylval->str,")") ) {
-				free(yylval->str);
-				yylval->str = 0;
-				my_col++; /* XXX why ? */
-				return RP;
-			} else {
-				unput(')');
-				return word;
-			}
+			yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
+			unput(')');
+			return word;
 		}
 	}
 	YY_BREAK
 case 49:
 /* rule 49 can match eol */
 YY_RULE_SETUP
-#line 309 "ael.flex"
+#line 303 "ael.flex"
 {
 		if( parencount != 0) { /* printf("Folding in a comma!\n"); */
 			yymore();
@@ -1449,8 +1443,7 @@
 				/* printf("Got argg2 word %s\n", yylval->str); */
 				unput(',');
 				commaout = 1;
-				if (yyleng > 1 )
-					*(yylval->str+yyleng-1)=0;
+				yylval->str[yyleng-1] = '\0';
 				return word;
 			} else {
 				commaout = 0;
@@ -1463,7 +1456,7 @@
 case 50:
 /* rule 50 can match eol */
 YY_RULE_SETUP
-#line 335 "ael.flex"
+#line 328 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		if ( pbcpop(c) ) { /* error */
@@ -1479,7 +1472,7 @@
 case 51:
 /* rule 51 can match eol */
 YY_RULE_SETUP
-#line 349 "ael.flex"
+#line 342 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		yymore();
@@ -1489,7 +1482,7 @@
 case 52:
 /* rule 52 can match eol */
 YY_RULE_SETUP
-#line 355 "ael.flex"
+#line 348 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		if ( pbcpop(c) ) { /* error */
@@ -1505,7 +1498,7 @@
 case 53:
 /* rule 53 can match eol */
 YY_RULE_SETUP
-#line 367 "ael.flex"
+#line 360 "ael.flex"
 {
 		STORE_LOC;
 		yylval->str = strdup(yytext);
@@ -1519,7 +1512,7 @@
 case 54:
 /* rule 54 can match eol */
 YY_RULE_SETUP
-#line 377 "ael.flex"
+#line 370 "ael.flex"
 {
 		FILE *in1;
 		char fnamebuf[1024],*p1,*p2;
@@ -1586,7 +1579,7 @@
 case YY_STATE_EOF(paren):
 case YY_STATE_EOF(semic):
 case YY_STATE_EOF(argg):
-#line 439 "ael.flex"
+#line 432 "ael.flex"
 {
 		if ( --include_stack_index < 0 ) {
 			yyterminate();
@@ -1602,10 +1595,10 @@
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 452 "ael.flex"
+#line 445 "ael.flex"
 ECHO;
 	YY_BREAK
-#line 1609 "ael_lex.c"
+#line 1602 "ael_lex.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -2735,7 +2728,7 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 452 "ael.flex"
+#line 445 "ael.flex"
 
 
 



More information about the asterisk-commits mailing list