Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@@ -40,6 +40,11 @@ static char sccsid[] = "@(#)reader.c 5.7 (Berkeley) 1/20/91";
#include "defs.h"
/* this resolves "unresolved symbol _snprintf" on Windows */
#if defined (_MSC_VER)
#define snprintf _snprintf
#endif
/* The line size must be a positive integer. One hundred was chosen */
/* because few lines in Yacc input grammars exceed 100 characters. */
/* Note that if a line exceeds LINESIZE characters, the line buffer */
@@ -1281,9 +1286,10 @@ loop:
if ((lineno - (a_lineno + comment_lines)) > 2)
{
char mname[20];
char line_define[256];
char mname[28];
char *line_define;
// the maximum size of of an unsigned int in characters is 20, with 8 for 'case_()\0'
sprintf(mname, "case_%d()", nrules - 2);
putc(' ', f); putc(' ', f);
@@ -1300,6 +1306,7 @@ loop:
methods = REALLOC (methods, maxmethods*sizeof(char *));
}
line_define = NEW2(snprintf(NULL, 0, line_format, a_lineno, input_file_name)+1, char);
sprintf(line_define, line_format, a_lineno, input_file_name);
mbody = NEW2(5+strlen(line_define)+1+strlen(mname)+strlen(buffer)+1, char);
@@ -1309,6 +1316,8 @@ loop:
strcat(mbody, line_define);
strcat(mbody, buffer);
methods[nmethods++] = mbody;
FREE(line_define);
}
else
{