Made Lemon's dynamic stack size compatible with C++

This commit is contained in:
alexey.lysiuk 2017-07-23 11:52:31 +03:00
parent 370e53befe
commit 28e6477a03

View file

@ -296,10 +296,10 @@ static int yyGrowStack(yyParser *p){
newSize = p->yystksz*2 + 100;
idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
if( p->yystack==&p->yystk0 ){
pNew = malloc(newSize*sizeof(pNew[0]));
pNew = (yyStackEntry *)malloc(newSize*sizeof(pNew[0]));
if( pNew ) pNew[0] = p->yystk0;
}else{
pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
pNew = (yyStackEntry *)realloc(p->yystack, newSize*sizeof(pNew[0]));
}
if( pNew ){
p->yystack = pNew;