Rev 902 | Rev 1248 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 902 | Rev 1154 | ||
|---|---|---|---|
| Line 51... | Line 51... | ||
| 51 | 51 | ||
| 52 | ASSERT(h); |
52 | ASSERT(h); |
| 53 | ASSERT(op && op->hash && op->compare); |
53 | ASSERT(op && op->hash && op->compare); |
| 54 | ASSERT(max_keys > 0); |
54 | ASSERT(max_keys > 0); |
| 55 | 55 | ||
| 56 | h->entry = malloc(m * sizeof(link_t *), 0); |
56 | h->entry = malloc(m * sizeof(link_t), 0); |
| 57 | if (!h->entry) { |
57 | if (!h->entry) { |
| 58 | panic("cannot allocate memory for hash table\n"); |
58 | panic("cannot allocate memory for hash table\n"); |
| 59 | } |
59 | } |
| 60 | memsetb((__address) h->entry, m * sizeof(link_t *), 0); |
60 | memsetb((__address) h->entry, m * sizeof(link_t), 0); |
| 61 | 61 | ||
| 62 | for (i = 0; i < m; i++) |
62 | for (i = 0; i < m; i++) |
| 63 | list_initialize(&h->entry[i]); |
63 | list_initialize(&h->entry[i]); |
| 64 | 64 | ||
| 65 | h->entries = m; |
65 | h->entries = m; |