4 #define HASHMUL 79L /* this is a good value */
5 static Symtab *hash[NHASH];
12 for(s = hash; s < &hash[NHASH]; s++){
13 for(ss = *s; ss; ss = ss->next)
20 symlook(char *sym, int space, void *install)
26 for(p = sym, h = space; *p; h += *p++)
31 for(s = hash[h]; s; s = s->next)
32 if((s->space == space) && (strcmp(s->name, sym) == 0))
36 s = (Symtab *)Malloc(sizeof(Symtab));
46 symdel(char *sym, int space)
52 /* multiple memory leaks */
54 for(p = sym, h = space; *p; h += *p++)
59 for(s = hash[h], ls = 0; s; ls = s, s = s->next)
60 if((s->space == space) && (strcmp(s->name, sym) == 0)){
70 symtraverse(int space, void (*fn)(Symtab*))
74 for(s = hash; s < &hash[NHASH]; s++)
75 for(ss = *s; ss; ss = ss->next)
76 if(ss->space == space)
87 memset((char *)l, 0, sizeof(l));
88 for(s = hash; s < &hash[NHASH]; s++){
89 for(ss = *s, n = 0; ss; ss = ss->next)
93 for(n = 0; n < 1000; n++)
94 if(l[n]) Bprint(&bout, "%ld of length %d\n", l[n], n);