Subversion Repositories HelenOS

Rev

Rev 4348 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4348 Rev 4691
Line 49... Line 49...
49
 * @param h Hash table structure. Will be initialized by this call.
49
 * @param h Hash table structure. Will be initialized by this call.
50
 * @param m Number of slots in the hash table.
50
 * @param m Number of slots in the hash table.
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, size_t m, size_t max_keys, hash_table_operations_t *op)
55
{
55
{
56
    index_t i;
56
    size_t i;
57
 
57
 
58
    ASSERT(h);
58
    ASSERT(h);
59
    ASSERT(op);
59
    ASSERT(op);
60
    ASSERT(op->hash);
60
    ASSERT(op->hash);
61
    ASSERT(op->compare);
61
    ASSERT(op->compare);
Line 81... Line 81...
81
 * @param key Array of all keys necessary to compute hash index.
81
 * @param key Array of all keys necessary to compute hash index.
82
 * @param item Item to be inserted into the hash table.
82
 * @param item Item to be inserted into the hash table.
83
 */
83
 */
84
void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item)
84
void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item)
85
{
85
{
86
    index_t chain;
86
    size_t chain;
87
   
87
   
88
    ASSERT(item);
88
    ASSERT(item);
89
    ASSERT(h);
89
    ASSERT(h);
90
    ASSERT(h->op);
90
    ASSERT(h->op);
91
    ASSERT(h->op->hash);
91
    ASSERT(h->op->hash);
Line 105... Line 105...
105
 * @return Matching item on success, NULL if there is no such item.
105
 * @return Matching item on success, NULL if there is no such item.
106
 */
106
 */
107
link_t *hash_table_find(hash_table_t *h, unative_t key[])
107
link_t *hash_table_find(hash_table_t *h, unative_t key[])
108
{
108
{
109
    link_t *cur;
109
    link_t *cur;
110
    index_t chain;
110
    size_t chain;
111
   
111
   
112
    ASSERT(h);
112
    ASSERT(h);
113
    ASSERT(h->op);
113
    ASSERT(h->op);
114
    ASSERT(h->op->hash);
114
    ASSERT(h->op->hash);
115
    ASSERT(h->op->compare);
115
    ASSERT(h->op->compare);
Line 135... Line 135...
135
 *
135
 *
136
 * @param h Hash table.
136
 * @param h Hash table.
137
 * @param key Array of keys that will be compared against items of the hash table.
137
 * @param key Array of keys that will be compared against items of the hash table.
138
 * @param keys Number of keys in the key array.
138
 * @param keys Number of keys in the key array.
139
 */
139
 */
140
void hash_table_remove(hash_table_t *h, unative_t key[], count_t keys)
140
void hash_table_remove(hash_table_t *h, unative_t key[], size_t keys)
141
{
141
{
142
    index_t chain;
142
    size_t chain;
143
    link_t *cur;
143
    link_t *cur;
144
   
144
   
145
    ASSERT(h);
145
    ASSERT(h);
146
    ASSERT(h->op);
146
    ASSERT(h->op);
147
    ASSERT(h->op->hash);
147
    ASSERT(h->op->hash);