4
#define HASHMUL 79L /* this is a good value */
5
static Symtab *hash[NHASH];
10
Symtab **s, *ss, *next;
12
for(s = hash; s < &hash[NHASH]; s++){
13
for(ss = *s; ss; ss = next){
22
symlook(char *sym, int space, void *install)
28
for(p = sym, h = space; *p; h += *p++)
33
for(s = hash[h]; s; s = s->next)
34
if((s->space == space) && (strcmp(s->name, sym) == 0))
38
s = (Symtab *)Malloc(sizeof(Symtab));
48
symdel(char *sym, int space)
54
/* multiple memory leaks */
56
for(p = sym, h = space; *p; h += *p++)
61
for(s = hash[h], ls = 0; s; ls = s, s = s->next)
62
if((s->space == space) && (strcmp(s->name, sym) == 0)){
72
symtraverse(int space, void (*fn)(Symtab*))
76
for(s = hash; s < &hash[NHASH]; s++)
77
for(ss = *s; ss; ss = ss->next)
78
if(ss->space == space)
89
memset((char *)l, 0, sizeof(l));
90
for(s = hash; s < &hash[NHASH]; s++){
91
for(ss = *s, n = 0; ss; ss = ss->next)
95
for(n = 0; n < 1000; n++)
96
if(l[n]) Bprint(&bout, "%ld of length %d\n", l[n], n);