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.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162140 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2008-12-09 18:35:35 +00:00
parent 67cb0526b7
commit 24395ed5c7
2 changed files with 103 additions and 77 deletions

View File

@@ -308,8 +308,9 @@ includes { STORE_POS; return KW_INCLUDES;}
/* 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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
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 @@ includes { STORE_POS; return KW_INCLUDES;}
<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;