#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 */
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);
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);
strcat(mbody, line_define);
strcat(mbody, buffer);
methods[nmethods++] = mbody;
+
+ FREE(line_define);
}
else
{