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/branches/1.4@162136 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2008-12-09 18:13:39 +00:00
parent cbbd837a34
commit fd31201630
2 changed files with 105 additions and 79 deletions

View File

@@ -302,8 +302,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);
prev_word = yylval->str;
@@ -314,8 +315,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--;
@@ -342,8 +344,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();
@@ -355,8 +358,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--;
@@ -383,8 +387,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();
@@ -403,8 +408,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;
}
@@ -413,8 +419,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;
@@ -436,9 +443,10 @@ 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);
return word;
yylval->str = malloc(yyleng+1);
strncpy(yylval->str, yytext, yyleng);
yylval->str[yyleng] = 0;
return word;
}
yymore();
}
@@ -465,8 +473,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;
}
@@ -478,8 +487,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;
@@ -493,8 +502,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;
}
@@ -506,8 +516,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();
@@ -530,8 +541,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();
@@ -539,8 +551,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;