Rev 997 | Rev 1336 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 997 | Rev 1202 | ||
---|---|---|---|
Line 52... | Line 52... | ||
52 | 52 | ||
53 | assert(h); |
53 | assert(h); |
54 | assert(op && op->hash && op->compare); |
54 | assert(op && op->hash && op->compare); |
55 | assert(max_keys > 0); |
55 | assert(max_keys > 0); |
56 | 56 | ||
57 | h->entry = malloc(m * sizeof(link_t *)); |
57 | h->entry = malloc(m * sizeof(link_t)); |
58 | if (!h->entry) { |
58 | if (!h->entry) { |
59 | printf("cannot allocate memory for hash table\n"); |
59 | printf("cannot allocate memory for hash table\n"); |
60 | return false; |
60 | return false; |
61 | } |
61 | } |
62 | memset((void *) h->entry, 0, m * sizeof(link_t *)); |
62 | memset((void *) h->entry, 0, m * sizeof(link_t)); |
63 | 63 | ||
64 | for (i = 0; i < m; i++) |
64 | for (i = 0; i < m; i++) |
65 | list_initialize(&h->entry[i]); |
65 | list_initialize(&h->entry[i]); |
66 | 66 | ||
67 | h->entries = m; |
67 | h->entries = m; |