Long-standing bug in syminit, tickled by placing

initshell before syminit.  Don't understand why syminit
exists at all.
This commit is contained in:
rsc 2005-01-15 20:54:41 +00:00
parent 5ad21e8620
commit 3300f9cd89
2 changed files with 5 additions and 3 deletions

View file

@ -39,7 +39,6 @@ main(int argc, char **argv)
* instead of sharing them
*/
initshell();
Binit(&bout, 1, OWRITE);
buf = newbuf();
whatif = 0;
@ -120,6 +119,7 @@ main(int argc, char **argv)
iflag = 1;
usage();
syminit();
initshell();
initenv();
usage();

View file

@ -7,11 +7,13 @@ static Symtab *hash[NHASH];
void
syminit(void)
{
Symtab **s, *ss;
Symtab **s, *ss, *next;
for(s = hash; s < &hash[NHASH]; s++){
for(ss = *s; ss; ss = ss->next)
for(ss = *s; ss; ss = next){
next = ss->next;
free((char *)ss);
}
*s = 0;
}
}