hash/hashtable.h

31 lines
542 B
C
Raw Normal View History

2024-06-28 22:37:51 +00:00
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
bool exists;
size_t sizet;
} size_t_optional;
typedef struct {
char* name;
void* data;
} hashtable_item;
typedef struct {
size_t capacity;
size_t filled;
hashtable_item* items;
} hashtable;
hashtable* hashtable_create(void);
void hashtable_destroy(hashtable*);
size_t_optional hashtable_key(hashtable*, char*);
size_t hashtable_insert(hashtable*, char*);
void* hashtable_get(hashtable* table, char* name);
void hashtable_set(hashtable* table, char* name, void* data);