23 lines
727 B
C
23 lines
727 B
C
#include <stdbool.h>
|
|
|
|
/* Hash table with linear probing implementation.
|
|
* The keys are always strings, the values can be anything.
|
|
* The table does not own any data.
|
|
*/
|
|
|
|
struct string_table;
|
|
|
|
struct string_table *new_table(void);
|
|
void free_table(struct string_table *t);
|
|
|
|
/* Inserts a new entry in the table. If the key is already present, the new value
|
|
* substitutes the old one
|
|
*/
|
|
void string_table_insert(struct string_table *t, const char *key, void *value);
|
|
|
|
/* Remove, if it's present, the entry for the given key */
|
|
void string_table_remove(struct string_table *t, const char *key);
|
|
|
|
/* Lookup a key, returns its value if found, otherwise NULL */
|
|
void *string_table_lookup(struct string_table *t, const char *key);
|