hash_table.h (770B)
1 /* hash_table.h */ 2 #ifndef HASH_TABLE_H 3 #define HASH_TABLE_H 4 5 /* Hash Table Opaque Types */ 6 typedef struct hash_table hash_table_t; 7 typedef int (*hash_table_cmp_fn)(const void *key1, const void *key2); 8 typedef unsigned int (*hash_table_hash_fn)(const void *key); 9 typedef void (*hash_table_dtor)(void *data, int is_key); 10 11 /* Hash Table Creation and Destruction */ 12 hash_table_t *hash_table_create(int size, hash_table_cmp_fn cmp, hash_table_hash_fn hash, hash_table_dtor dtor); 13 void hash_table_destroy(hash_table_t *table); 14 15 /* Hash Table Access */ 16 void *hash_table_get(const hash_table_t *table, const void *key); 17 void hash_table_put(hash_table_t *table, void *key, void *value); 18 void hash_table_remove(hash_table_t *table, const void *key); 19 20 21 #endif /* HASH_TABLE_H */ 22