Rev 996 | Rev 1335 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 996 | Rev 997 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | * |
51 | * |
52 | * @param key Array of keys needed to compute hash index. All keys must be passed. |
52 | * @param key Array of keys needed to compute hash index. All keys must be passed. |
53 | * |
53 | * |
54 | * @return Index into hash table. |
54 | * @return Index into hash table. |
55 | */ |
55 | */ |
56 | hash_index_t (* hash)(int key[]); |
56 | hash_index_t (* hash)(unsigned long key[]); |
57 | 57 | ||
58 | /** Hash table item comparison function. |
58 | /** Hash table item comparison function. |
59 | * |
59 | * |
60 | * @param key Array of keys that will be compared with item. It is not necessary to pass all keys. |
60 | * @param key Array of keys that will be compared with item. It is not necessary to pass all keys. |
61 | * |
61 | * |
62 | * @return true if the keys match, false otherwise. |
62 | * @return true if the keys match, false otherwise. |
63 | */ |
63 | */ |
64 | int (*compare)(int key[], hash_count_t keys, link_t *item); |
64 | int (*compare)(unsigned long key[], hash_count_t keys, link_t *item); |
65 | 65 | ||
66 | /** Hash table item removal callback. |
66 | /** Hash table item removal callback. |
67 | * |
67 | * |
68 | * @param item Item that was removed from the hash table. |
68 | * @param item Item that was removed from the hash table. |
69 | */ |
69 | */ |
70 | void (*remove_callback)(link_t *item); |
70 | void (*remove_callback)(link_t *item); |
71 | }; |
71 | }; |
72 | 72 | ||
73 | #define hash_table_get_instance(item, type, member) list_get_instance((item), type, member) |
73 | #define hash_table_get_instance(item, type, member) list_get_instance((item), type, member) |
74 | 74 | ||
75 | extern void hash_table_create(hash_table_t *h, hash_count_t m, hash_count_t max_keys, hash_table_operations_t *op); |
75 | extern int hash_table_create(hash_table_t *h, hash_count_t m, hash_count_t max_keys, hash_table_operations_t *op); |
76 | extern void hash_table_insert(hash_table_t *h, int key[], link_t *item); |
76 | extern void hash_table_insert(hash_table_t *h, unsigned long key[], link_t *item); |
77 | extern link_t *hash_table_find(hash_table_t *h, int key[]); |
77 | extern link_t *hash_table_find(hash_table_t *h, unsigned long key[]); |
78 | extern void hash_table_remove(hash_table_t *h, int key[], hash_count_t keys); |
78 | extern void hash_table_remove(hash_table_t *h, unsigned long key[], hash_count_t keys); |
79 | 79 | ||
80 | #endif |
80 | #endif |