Subversion Repositories HelenOS

Rev

Rev 2089 | Rev 3790 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2089 Rev 2112
Line 51... Line 51...
51
 * @param max_keys Maximal number of keys needed to identify an item.
51
 * @param max_keys Maximal number of keys needed to identify an item.
52
 * @param op Hash table operations structure.
52
 * @param op Hash table operations structure.
53
 */
53
 */
54
void hash_table_create(hash_table_t *h, count_t m, count_t max_keys, hash_table_operations_t *op)
54
void hash_table_create(hash_table_t *h, count_t m, count_t max_keys, hash_table_operations_t *op)
55
{
55
{
56
    int i;
56
    index_t i;
57
 
57
 
58
    ASSERT(h);
58
    ASSERT(h);
59
    ASSERT(op && op->hash && op->compare);
59
    ASSERT(op && op->hash && op->compare);
60
    ASSERT(max_keys > 0);
60
    ASSERT(max_keys > 0);
61
   
61
   
62
    h->entry = malloc(m * sizeof(link_t), 0);
62
    h->entry = (link_t *) malloc(m * sizeof(link_t), 0);
63
    if (!h->entry) {
63
    if (!h->entry) {
64
        panic("cannot allocate memory for hash table\n");
64
        panic("cannot allocate memory for hash table\n");
65
    }
65
    }
66
    memsetb((uintptr_t) h->entry, m * sizeof(link_t), 0);
66
    memsetb((uintptr_t) h->entry, m * sizeof(link_t), 0);
67
   
67