* Don't assume realloc() can take NULL as first arg. Yacc needs to
generate portable code... * Correctly define yyparse() (ie, K&R vs. C++/ANSI-C) Obtained from: OpenBSD revs 1.5 & 1.10
This commit is contained in:
parent
d91908a43c
commit
e7bd01e5df
@ -33,7 +33,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: skeleton.c,v 1.15 1999/04/18 13:37:49 peter Exp $
|
* $Id: skeleton.c,v 1.16 1999/07/29 08:47:30 obrien Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
@ -142,11 +142,15 @@ char *body[] =
|
|||||||
" else if ((newsize *= 2) > YYMAXDEPTH)",
|
" else if ((newsize *= 2) > YYMAXDEPTH)",
|
||||||
" newsize = YYMAXDEPTH;",
|
" newsize = YYMAXDEPTH;",
|
||||||
" i = yyssp - yyss;",
|
" i = yyssp - yyss;",
|
||||||
" if ((newss = (short *)realloc(yyss, newsize * sizeof *newss)) == NULL)",
|
" newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :",
|
||||||
|
" (short *)malloc(newsize * sizeof *newss);",
|
||||||
|
" if (newss == NULL)",
|
||||||
" return -1;",
|
" return -1;",
|
||||||
" yyss = newss;",
|
" yyss = newss;",
|
||||||
" yyssp = newss + i;",
|
" yyssp = newss + i;",
|
||||||
" if ((newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs)) == NULL)",
|
" newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :",
|
||||||
|
" (YYSTYPE *)malloc(newsize * sizeof *newvs);",
|
||||||
|
" if (newvs == NULL)",
|
||||||
" return -1;",
|
" return -1;",
|
||||||
" yyvs = newvs;",
|
" yyvs = newvs;",
|
||||||
" yyvsp = newvs + i;",
|
" yyvsp = newvs + i;",
|
||||||
@ -161,7 +165,11 @@ char *body[] =
|
|||||||
"#define YYERROR goto yyerrlab",
|
"#define YYERROR goto yyerrlab",
|
||||||
"",
|
"",
|
||||||
"int",
|
"int",
|
||||||
|
"#if defined(__cplusplus) || __STDC__",
|
||||||
|
"yyparse(void)",
|
||||||
|
"#else",
|
||||||
"yyparse()",
|
"yyparse()",
|
||||||
|
"#endif",
|
||||||
"{",
|
"{",
|
||||||
" register int yym, yyn, yystate;",
|
" register int yym, yyn, yystate;",
|
||||||
"#if YYDEBUG",
|
"#if YYDEBUG",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user