1
0
mirror of https://github.com/golang/go synced 2024-11-26 00:57:56 -07:00

5a/6a/8a: avoid fixed-sized file name buffer

R=rsc
CC=golang-dev
https://golang.org/cl/186279
This commit is contained in:
Dean Prichard 2010-01-22 16:59:17 -08:00 committed by Russ Cox
parent 31fb879ec2
commit 07d3e0dce4
5 changed files with 8 additions and 3 deletions

View File

@ -139,9 +139,10 @@ main(int argc, char *argv[])
int int
assemble(char *file) assemble(char *file)
{ {
char ofile[100], incfile[20], *p; char *ofile, incfile[20], *p;
int i, of; int i, of;
ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar)
strcpy(ofile, file); strcpy(ofile, file);
p = utfrrune(ofile, '/'); p = utfrrune(ofile, '/');
if(p) { if(p) {

View File

@ -168,6 +168,7 @@ EXTERN char* thestring;
EXTERN int32 thunk; EXTERN int32 thunk;
EXTERN Biobuf obuf; EXTERN Biobuf obuf;
void* alloc(int32);
void* allocn(void*, int32, int32); void* allocn(void*, int32, int32);
void errorexit(void); void errorexit(void);
void pushio(void); void pushio(void);

View File

@ -139,9 +139,10 @@ main(int argc, char *argv[])
int int
assemble(char *file) assemble(char *file)
{ {
char ofile[100], incfile[20], *p; char *ofile, incfile[20], *p;
int i, of; int i, of;
ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar)
strcpy(ofile, file); strcpy(ofile, file);
p = utfrrune(ofile, pathchar()); p = utfrrune(ofile, pathchar());
if(p) { if(p) {

View File

@ -169,6 +169,7 @@ EXTERN char* thestring;
EXTERN int32 thunk; EXTERN int32 thunk;
EXTERN Biobuf obuf; EXTERN Biobuf obuf;
void* alloc(int32);
void* allocn(void*, int32, int32); void* allocn(void*, int32, int32);
void errorexit(void); void errorexit(void);
void pushio(void); void pushio(void);

View File

@ -138,9 +138,10 @@ main(int argc, char *argv[])
int int
assemble(char *file) assemble(char *file)
{ {
char ofile[100], incfile[20], *p; char *ofile, incfile[20], *p;
int i, of; int i, of;
ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar)
strcpy(ofile, file); strcpy(ofile, file);
p = utfrrune(ofile, pathchar()); p = utfrrune(ofile, pathchar());
if(p) { if(p) {