[svn-commits] murf: trunk r162140 - in /trunk: ./ res/ael/ael.flex res/ael/ael_lex.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 9 12:35:36 CST 2008


Author: murf
Date: Tue Dec  9 12:35:35 2008
New Revision: 162140

URL: http://svn.digium.com/view/asterisk?view=rev&rev=162140
Log:
Merged revisions 162136 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r162136 | murf | 2008-12-09 11:13:39 -0700 (Tue, 09 Dec 2008) | 1 line

Previous fix used ast_malloc and ast_copy_string and messed up the standalone stuff. Fixed.
........

Modified:
    trunk/   (props changed)
    trunk/res/ael/ael.flex
    trunk/res/ael/ael_lex.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/res/ael/ael.flex
URL: http://svn.digium.com/view/asterisk/trunk/res/ael/ael.flex?view=diff&rev=162140&r1=162139&r2=162140
==============================================================================
--- trunk/res/ael/ael.flex (original)
+++ trunk/res/ael/ael.flex Tue Dec  9 12:35:35 2008
@@ -308,8 +308,9 @@
 		/* a non-word constituent char, like a space, tab, curly, paren, etc */
 		char c = yytext[yyleng-1];
 		STORE_POS;
-		yylval->str = ast_malloc(yyleng);
-		ast_copy_string(yylval->str, yytext, yyleng);
+		yylval->str = malloc(yyleng);
+		strncpy(yylval->str, yytext, yyleng);
+		yylval->str[yyleng-1] = 0;
 		unput(c);  /* put this ending char back in the stream */
 		BEGIN(0);
 		return word;
@@ -321,8 +322,9 @@
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 		parencount2--;
@@ -349,8 +351,9 @@
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
 				my_file, my_lineno, my_col, c);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 		yymore();
@@ -362,8 +365,9 @@
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 		parencount3--;
@@ -390,8 +394,9 @@
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
 				my_file, my_lineno, my_col, c);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 		yymore();
@@ -410,8 +415,9 @@
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			prev_word = 0;
 			return word;
 		}
@@ -420,8 +426,9 @@
 			yymore();
 		} else {
 			STORE_LOC;
-			yylval->str = ast_malloc(yyleng);
-			ast_copy_string(yylval->str, yytext, yyleng);
+			yylval->str = malloc(yyleng);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng-1] = 0;
 			unput(')');
 			BEGIN(0);
 			return word;
@@ -443,8 +450,9 @@
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
 				my_file, my_lineno, my_col, c);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 		yymore();
@@ -472,8 +480,9 @@
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno, my_col);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 
@@ -485,8 +494,8 @@
 			BEGIN(0);
 			if ( !strcmp(yytext, ")") )
 				return RP;
-			yylval->str = ast_malloc(yyleng);
-			ast_copy_string(yylval->str, yytext, yyleng);
+			yylval->str = malloc(yyleng);
+			strncpy(yylval->str, yytext, yyleng);
 			yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
 			unput(')');
 			return word;
@@ -500,8 +509,9 @@
 			STORE_LOC;
 			if( !strcmp(yytext,"," ) )
 				return COMMA;
-			yylval->str = ast_malloc(yyleng);
-			ast_copy_string(yylval->str, yytext, yyleng);
+			yylval->str = malloc(yyleng);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng-1] = '\0'; /* trim trailing ',' */
 			unput(',');
 			return word;
 		}
@@ -513,8 +523,9 @@
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = '\0';
 			return word;
 		}
 		yymore();
@@ -537,8 +548,9 @@
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = '\0';
 			return word;
 		}
 		yymore();
@@ -546,8 +558,9 @@
 
 <semic>{NOSEMIC};	{
 		STORE_LOC;
-		yylval->str = ast_malloc(yyleng);
-		ast_copy_string(yylval->str, yytext, yyleng);
+		yylval->str = malloc(yyleng);
+		strncpy(yylval->str, yytext, yyleng);
+		yylval->str[yyleng-1] = '\0'; /* trim trailing ';' */
 		unput(';');
 		BEGIN(0);
 		return word;

Modified: trunk/res/ael/ael_lex.c
URL: http://svn.digium.com/view/asterisk/trunk/res/ael/ael_lex.c?view=diff&rev=162140&r1=162139&r2=162140
==============================================================================
--- trunk/res/ael/ael_lex.c (original)
+++ trunk/res/ael/ael_lex.c Tue Dec  9 12:35:35 2008
@@ -1613,8 +1613,9 @@
 		/* a non-word constituent char, like a space, tab, curly, paren, etc */
 		char c = yytext[yyleng-1];
 		STORE_POS;
-		yylval->str = ast_malloc(yyleng);
-		ast_copy_string(yylval->str, yytext, yyleng);
+		yylval->str = malloc(yyleng);
+		strncpy(yylval->str, yytext, yyleng);
+		yylval->str[yyleng-1] = 0;
 		unput(c);  /* put this ending char back in the stream */
 		BEGIN(0);
 		return word;
@@ -1623,14 +1624,15 @@
 case 58:
 /* rule 58 can match eol */
 YY_RULE_SETUP
-#line 319 "ael.flex"
+#line 320 "ael.flex"
 {
 		if ( pbcpop2('}') ) {	/* error */
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 		parencount2--;
@@ -1645,7 +1647,7 @@
 case 59:
 /* rule 59 can match eol */
 YY_RULE_SETUP
-#line 337 "ael.flex"
+#line 339 "ael.flex"
 { 
 		char c = yytext[yyleng-1];
 		if (c == '{')
@@ -1657,7 +1659,7 @@
 case 60:
 /* rule 60 can match eol */
 YY_RULE_SETUP
-#line 345 "ael.flex"
+#line 347 "ael.flex"
 { 
 		char c = yytext[yyleng-1];
 		if ( pbcpop2(c))  { /* error */
@@ -1665,8 +1667,9 @@
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
 				my_file, my_lineno, my_col, c);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 		yymore();
@@ -1675,14 +1678,15 @@
 case 61:
 /* rule 61 can match eol */
 YY_RULE_SETUP
-#line 360 "ael.flex"
+#line 363 "ael.flex"
 {
 		if ( pbcpop3(']') ) {	/* error */
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 		parencount3--;
@@ -1697,7 +1701,7 @@
 case 62:
 /* rule 62 can match eol */
 YY_RULE_SETUP
-#line 378 "ael.flex"
+#line 382 "ael.flex"
 { 
 		char c = yytext[yyleng-1];
 		if (c == '[')
@@ -1709,7 +1713,7 @@
 case 63:
 /* rule 63 can match eol */
 YY_RULE_SETUP
-#line 386 "ael.flex"
+#line 390 "ael.flex"
 { 
 		char c = yytext[yyleng-1];
 		if ( pbcpop3(c))  { /* error */
@@ -1717,8 +1721,9 @@
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
 				my_file, my_lineno, my_col, c);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 		yymore();
@@ -1734,14 +1739,15 @@
 case 64:
 /* rule 64 can match eol */
 YY_RULE_SETUP
-#line 408 "ael.flex"
+#line 413 "ael.flex"
 {
 		if ( pbcpop(')') ) {	/* error */
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			prev_word = 0;
 			return word;
 		}
@@ -1750,8 +1756,9 @@
 			yymore();
 		} else {
 			STORE_LOC;
-			yylval->str = ast_malloc(yyleng);
-			ast_copy_string(yylval->str, yytext, yyleng);
+			yylval->str = malloc(yyleng);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng-1] = 0;
 			unput(')');
 			BEGIN(0);
 			return word;
@@ -1761,7 +1768,7 @@
 case 65:
 /* rule 65 can match eol */
 YY_RULE_SETUP
-#line 431 "ael.flex"
+#line 438 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		if (c == '(')
@@ -1773,7 +1780,7 @@
 case 66:
 /* rule 66 can match eol */
 YY_RULE_SETUP
-#line 439 "ael.flex"
+#line 446 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		if ( pbcpop(c))  { /* error */
@@ -1781,8 +1788,9 @@
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
 				my_file, my_lineno, my_col, c);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 		yymore();
@@ -1799,7 +1807,7 @@
 case 67:
 /* rule 67 can match eol */
 YY_RULE_SETUP
-#line 462 "ael.flex"
+#line 470 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		if (c == '(')
@@ -1811,14 +1819,15 @@
 case 68:
 /* rule 68 can match eol */
 YY_RULE_SETUP
-#line 470 "ael.flex"
+#line 478 "ael.flex"
 {
 		if ( pbcpop(')') ) { /* error */
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno, my_col);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = 0;
 			return word;
 		}
 
@@ -1830,8 +1839,8 @@
 			BEGIN(0);
 			if ( !strcmp(yytext, ")") )
 				return RP;
-			yylval->str = ast_malloc(yyleng);
-			ast_copy_string(yylval->str, yytext, yyleng);
+			yylval->str = malloc(yyleng);
+			strncpy(yylval->str, yytext, yyleng);
 			yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
 			unput(')');
 			return word;
@@ -1841,7 +1850,7 @@
 case 69:
 /* rule 69 can match eol */
 YY_RULE_SETUP
-#line 496 "ael.flex"
+#line 505 "ael.flex"
 {
 		if( parencount != 0) { /* ast_log(LOG_NOTICE,"Folding in a comma!\n"); */
 			yymore();
@@ -1849,8 +1858,9 @@
 			STORE_LOC;
 			if( !strcmp(yytext,"," ) )
 				return COMMA;
-			yylval->str = ast_malloc(yyleng);
-			ast_copy_string(yylval->str, yytext, yyleng);
+			yylval->str = malloc(yyleng);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng-1] = '\0'; /* trim trailing ',' */
 			unput(',');
 			return word;
 		}
@@ -1859,15 +1869,16 @@
 case 70:
 /* rule 70 can match eol */
 YY_RULE_SETUP
-#line 510 "ael.flex"
+#line 520 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		if ( pbcpop(c) ) { /* error */
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = '\0';
 			return word;
 		}
 		yymore();
@@ -1881,7 +1892,7 @@
 case 71:
 /* rule 71 can match eol */
 YY_RULE_SETUP
-#line 528 "ael.flex"
+#line 539 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		yymore();
@@ -1891,15 +1902,16 @@
 case 72:
 /* rule 72 can match eol */
 YY_RULE_SETUP
-#line 534 "ael.flex"
+#line 545 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		if ( pbcpop(c) ) { /* error */
 			STORE_LOC;
 			ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c);
 			BEGIN(0);
-			yylval->str = ast_malloc(yyleng+1);
-			ast_copy_string(yylval->str, yytext, yyleng+1);
+			yylval->str = malloc(yyleng+1);
+			strncpy(yylval->str, yytext, yyleng);
+			yylval->str[yyleng] = '\0';
 			return word;
 		}
 		yymore();
@@ -1908,11 +1920,12 @@
 case 73:
 /* rule 73 can match eol */
 YY_RULE_SETUP
-#line 547 "ael.flex"
+#line 559 "ael.flex"
 {
 		STORE_LOC;
-		yylval->str = ast_malloc(yyleng);
-		ast_copy_string(yylval->str, yytext, yyleng);
+		yylval->str = malloc(yyleng);
+		strncpy(yylval->str, yytext, yyleng);
+		yylval->str[yyleng-1] = '\0'; /* trim trailing ';' */
 		unput(';');
 		BEGIN(0);
 		return word;
@@ -1921,7 +1934,7 @@
 case 74:
 /* rule 74 can match eol */
 YY_RULE_SETUP
-#line 556 "ael.flex"
+#line 569 "ael.flex"
 {
 		char fnamebuf[1024],*p1,*p2;
 		int glob_ret;
@@ -1974,7 +1987,7 @@
 case YY_STATE_EOF(curlystate):
 case YY_STATE_EOF(wordstate):
 case YY_STATE_EOF(brackstate):
-#line 601 "ael.flex"
+#line 614 "ael.flex"
 {
 		char fnamebuf[2048];
 		if (include_stack_index > 0 && include_stack[include_stack_index-1].globbuf_pos < include_stack[include_stack_index-1].globbuf.gl_pathc-1) {
@@ -2009,10 +2022,10 @@
 	YY_BREAK
 case 75:
 YY_RULE_SETUP
-#line 633 "ael.flex"
+#line 646 "ael.flex"
 ECHO;
 	YY_BREAK
-#line 2015 "ael_lex.c"
+#line 2028 "ael_lex.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -3185,7 +3198,7 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 633 "ael.flex"
+#line 646 "ael.flex"
 
 
 




More information about the svn-commits mailing list