diff options
author | Kamil Kaminski <kamilkss@gmail.com> | 2010-11-27 15:06:25 -0600 |
---|---|---|
committer | Kamil Kaminski <kamilkss@gmail.com> | 2010-11-27 15:06:25 -0600 |
commit | 4466182539196d2a2379481f08f0b0cacdf8ca75 (patch) | |
tree | 49f24ccbe2e36ebf835d84359ab239a9298f6c33 /hashtbl.h | |
download | hashtable-4466182539196d2a2379481f08f0b0cacdf8ca75.tar.gz hashtable-4466182539196d2a2379481f08f0b0cacdf8ca75.tar.bz2 hashtable-4466182539196d2a2379481f08f0b0cacdf8ca75.zip |
Initial commit
Diffstat (limited to 'hashtbl.h')
-rw-r--r-- | hashtbl.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/hashtbl.h b/hashtbl.h new file mode 100644 index 0000000..70428f8 --- /dev/null +++ b/hashtbl.h @@ -0,0 +1,31 @@ +#ifndef HASHTBL_H_ +#define HASHTBL_H_ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +typedef struct hashtbl +{ + size_t size; + struct hashnode_s **nodes; + unsigned int (*hashfunc)(const char *); +} HASHTBL; + +struct hashnode_s { + char *key; + void *data; + struct hashnode_s *next; +}; + +/* function prototypes */ +char *strdup(const char *); +HASHTBL *hashtbl_create(size_t, unsigned int (*hashfunc)(const char *)); +void hashtbl_destroy(HASHTBL *); +int hashtbl_insert(HASHTBL *, const char *, void *); +int hashtbl_remove(HASHTBL *, const char *); +void *hashtbl_get(HASHTBL *, const char *); +int hashtbl_resize(HASHTBL *, size_t); + +#endif + |