- for (np = ep->e_entries; np != NULL; np = np->e_sibling) {
- if (np->e_type == LEAF) {
- if (np->e_flags != 0)
- badentry(np, "unreferenced with flags");
- Dprintf(stdout,
- "%s: remove unreferenced name\n",
- myname(np));
- removeleaf(np);
- freeentry(np);
+ if (ep->e_entries == NULL)
+ continue;
+ for (j = 0; j < dirhash_size; j++) {
+ for (np = ep->e_entries[j]; np != NULL; np = np->e_sibling) {
+ if (np->e_type == LEAF) {
+ if (np->e_flags != 0)
+ badentry(np, "unreferenced with flags");
+ Dprintf(stdout,
+ "%s: remove unreferenced name\n",
+ myname(np));
+ removeleaf(np);
+ freeentry(np);
+ } else {
+ if ((np->e_flags & ~TMPNAME) != 0)
+ badentry(np, "unreferenced with flags");
+
+ if (np->e_flags == 0) {
+ Dprintf(stdout,
+ "%s: remove unreferenced name\n",
+ myname(np));
+ np->e_next = ep->e_next;
+ ep->e_next = np;
+ }
+ }