2017-12-12 13:06:01 +01:00
|
|
|
#ifndef HASHTABLE_H_
|
|
|
|
#define HASHTABLE_H_
|
|
|
|
|
|
|
|
typedef struct entry_t {
|
|
|
|
char *key;
|
|
|
|
void *value;
|
|
|
|
struct entry_t *next;
|
|
|
|
} Entry;
|
|
|
|
|
|
|
|
typedef struct table_t {
|
|
|
|
unsigned int size;
|
|
|
|
Entry **entries;
|
|
|
|
} Hashtable;
|
|
|
|
|
|
|
|
Hashtable* ht_create(unsigned int size);
|
|
|
|
|
2017-12-13 23:20:54 +01:00
|
|
|
void ht_set(Hashtable*, const char *key, void *val);
|
2017-12-12 13:06:01 +01:00
|
|
|
|
2017-12-13 23:20:54 +01:00
|
|
|
void* ht_get(Hashtable*, const char *key);
|
2017-12-12 13:06:01 +01:00
|
|
|
|
|
|
|
void ht_destroy(Hashtable*);
|
|
|
|
|
2017-12-13 14:26:30 +01:00
|
|
|
void ht_destroy_custom(Hashtable*, void (*destroy_value)(void*));
|
|
|
|
|
2017-12-12 13:06:01 +01:00
|
|
|
#endif // HASHTABLE_H_
|