diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:08:27 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:08:27 +0200 |
| commit | c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c (patch) | |
| tree | 3e4f42f93c7ae89a364e4d51fff6e5cec4e55fa9 /rushs/evalexpr/hash_map/hash_map.h | |
add: graphs et rushs
Diffstat (limited to 'rushs/evalexpr/hash_map/hash_map.h')
| -rw-r--r-- | rushs/evalexpr/hash_map/hash_map.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/rushs/evalexpr/hash_map/hash_map.h b/rushs/evalexpr/hash_map/hash_map.h new file mode 100644 index 0000000..c731eab --- /dev/null +++ b/rushs/evalexpr/hash_map/hash_map.h @@ -0,0 +1,29 @@ +#ifndef HASH_MAP_H +#define HASH_MAP_H + +#include <stdbool.h> +#include <stddef.h> + +struct pair_list +{ + const char *key; + char *value; + struct pair_list *next; +}; + +struct hash_map +{ + struct pair_list **data; + size_t size; +}; + +size_t hash(const char *str); +struct hash_map *hash_map_init(size_t size); +bool hash_map_insert(struct hash_map *hash_map, const char *key, char *value, + bool *updated); +void hash_map_free(struct hash_map *hash_map); +void hash_map_dump(struct hash_map *hash_map); +const char *hash_map_get(const struct hash_map *hash_map, const char *key); +bool hash_map_remove(struct hash_map *hash_map, const char *key); + +#endif /* ! HASH_MAP_H */ |
