From: ceriel Date: Thu, 22 Oct 1992 16:56:28 +0000 (+0000) Subject: Removed static buffer in gen_idf X-Git-Tag: release-5-5~389 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=d9bd02fda6e30b3357f31bde7c3d8cac5460d60d;p=ack.git Removed static buffer in gen_idf --- diff --git a/lang/cem/cemcom.ansi/idf.c b/lang/cem/cemcom.ansi/idf.c index 4aa5ee7f9..ae0ec370b 100644 --- a/lang/cem/cemcom.ansi/idf.c +++ b/lang/cem/cemcom.ansi/idf.c @@ -47,11 +47,12 @@ gen_idf() anonymous name. */ static int name_cnt; - char buff[100]; + char *s = Malloc(strlen(dot.tk_file) + 50); - sprint(buff, "#%d in %s, line %u", + sprint(s, "#%d in %s, line %u", ++name_cnt, dot.tk_file, dot.tk_line); - return str2idf(buff, 1); + s = Realloc(s, strlen(s)+1); + return str2idf(s, 0); } int diff --git a/lang/m2/comp/misc.c b/lang/m2/comp/misc.c index c9177acf4..5b7ddc810 100644 --- a/lang/m2/comp/misc.c +++ b/lang/m2/comp/misc.c @@ -41,12 +41,13 @@ gen_anon_idf() anonymous name. */ static int name_cnt; - char buff[512]; + char *s = Malloc(strlen(FileName)+50); char *sprint(); - sprint(buff, "#%d in %s, line %u", + sprint(s, "#%d in %s, line %u", ++name_cnt, FileName, LineNumber); - return str2idf(buff, 1); + s = Realloc(s, strlen(s)+1); + return str2idf(s, 0); } not_declared(what, id, where) diff --git a/lang/pc/comp/misc.c b/lang/pc/comp/misc.c index 9e4f871e3..901d4e845 100644 --- a/lang/pc/comp/misc.c +++ b/lang/pc/comp/misc.c @@ -17,11 +17,12 @@ gen_anon_idf() anonymous name. */ static int name_cnt; - char buff[100]; + char *s = Malloc(strlen(FileName) + 50); char *sprint(); - sprint(buff, "#%d in %s, line %u", ++name_cnt, FileName, LineNumber); - return str2idf(buff, 1); + sprint(s, "#%d in %s, line %u", ++name_cnt, FileName, LineNumber); + s = Realloc(s, strlen(s)+1); + return str2idf(s, 0); } not_declared(what, id, where)