Commit 86cfaf66 authored by Rob Pike's avatar Rob Pike

reallocate library, libraryobj: 50 isn't nearly enough

R=rsc
DELTA=7  (2 added, 0 deleted, 5 changed)
OCL=35569
CL=35569
parent 6e4f9353
...@@ -153,9 +153,10 @@ addlib(char *src, char *obj) ...@@ -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);
......
...@@ -36,9 +36,10 @@ extern int cout; ...@@ -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];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment