4 #define HASHMUL 79UL /* 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++)
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++)
57 for(s = hash[h], ls = 0; s; ls = s, s = s->next)
58 if((s->space == space) && (strcmp(s->name, sym) == 0)){
68 symtraverse(int space, void (*fn)(Symtab*))
72 for(s = hash; s < &hash[NHASH]; s++)
73 for(ss = *s; ss; ss = ss->next)
74 if(ss->space == space)
85 memset((char *)l, 0, sizeof(l));
86 for(s = hash; s < &hash[NHASH]; s++){
87 for(ss = *s, n = 0; ss; ss = ss->next)
91 for(n = 0; n < 1000; n++)
92 if(l[n]) Bprint(&bout, "%ld of length %d\n", l[n], n);