1
0
mirror of https://github.com/golang/go synced 2024-11-22 09:24:41 -07:00

reallocate library, libraryobj: 50 isn't nearly enough

R=rsc
DELTA=7  (2 added, 0 deleted, 5 changed)
OCL=35569
CL=35569
This commit is contained in:
Rob Pike 2009-10-10 12:29:06 -07:00
parent 6e4f935369
commit 86cfaf66a7
2 changed files with 7 additions and 5 deletions

View File

@ -153,9 +153,10 @@ addlib(char *src, char *obj)
for(i=0; i<libraryp; i++) for(i=0; i<libraryp; i++)
if(strcmp(name, library[i]) == 0) if(strcmp(name, library[i]) == 0)
return; return;
if(libraryp == nelem(library)){ if(libraryp == nlibrary){
diag("too many autolibs; skipping %s", name); nlibrary = 50 + 2*libraryp;
return; library = realloc(library, sizeof library[0] * nlibrary);
libraryobj = realloc(libraryobj, sizeof libraryobj[0] * nlibrary);
} }
p = mal(strlen(name) + 1); p = mal(strlen(name) + 1);

View File

@ -36,9 +36,10 @@ extern int cout;
EXTERN char* INITENTRY; EXTERN char* INITENTRY;
EXTERN char thechar; EXTERN char thechar;
EXTERN char* thestring; EXTERN char* thestring;
EXTERN char* library[50]; EXTERN char** library;
EXTERN char* libraryobj[50]; EXTERN char** libraryobj;
EXTERN int libraryp; EXTERN int libraryp;
EXTERN int nlibrary;
EXTERN Sym* hash[NHASH]; EXTERN Sym* hash[NHASH];
EXTERN Sym* histfrog[MAXHIST]; EXTERN Sym* histfrog[MAXHIST];
EXTERN uchar fnuxi8[8]; EXTERN uchar fnuxi8[8];