3 --- hashtab.c 2007/10/03 12:04:01 1.1
4 +++ hashtab.c 2007/10/03 12:08:02
6 --------------------------------------------------------------------
9 +#include <sys/types.h>
21 /* sanity check -- make sure ipos, apos, and count make sense */
22 static void hsanity(t)
25 /* test that apos makes sense */
26 end = (ub4)1<<(t->logsize);
28 - printf("error: end %ld apos %ld\n", end, t->apos);
29 + printf("error: end %ld apos %ld\n", (long) end, (long) t->apos);
31 /* test that ipos is in bucket apos */
34 for (h=t->table[t->apos]; h && h != t->ipos; h = h->next)
37 - printf("error:ipos not in apos, apos is %ld\n", t->apos);
38 + printf("error:ipos not in apos, apos is %ld\n", (long) t->apos);
41 /* test that t->count is the number of elements in the table */
43 for (h=t->table[i]; h; h=h->next)
45 if (counter != t->count)
46 - printf("error: counter %ld t->count %ld\n", counter, t->count);
47 + printf("error: counter %ld t->count %ld\n", (long) counter, (long) t->count);
49 +#endif /* HASHTAB_DEBUG */
55 htab *t; /* the table */
59 free((char *)t->table);
63 for (walk=stat; walk; walk=walk->next)
65 - printf("items %ld: %ld buckets\n", walk->keyl, walk->hval);
66 + printf("items %ld: %ld buckets\n", (long)walk->keyl, (long)walk->hval);
68 printf("\nbuckets: %ld items: %ld existing: %g\n\n",
69 - ((ub4)1<<t->logsize), t->count, total);
70 + (long)((ub4)1<<t->logsize), (long)t->count, total);