aboutsummaryrefslogtreecommitdiff
path: root/src/hashtbl.h
blob: a6cfa10818f9155c75dd5e97224f4a4e076d413b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef HASHTBL_H
#define HASHTBL_H

typedef struct hash_table *hashtbl_t;

struct hash_table {    
    struct hash_item {
        struct hash_item *next;
        char *key;
        void *data;
    } **items;
    
    size_t cap;
};

hashtbl_t hashtbl_create(size_t cap);
void hashtbl_destroy(hashtbl_t hashtbl);
void hashtbl_reset(hashtbl_t hashtbl);

int hashtbl_insert(hashtbl_t hashtbl, char *key, void *data, size_t data_sz);
int hashtbl_query(hashtbl_t hashtbl, char *key, void **dest);

#endif