diff options
author | epochqwert <epoch@hacking.allowed.org> | 2015-03-31 12:54:01 -0500 |
---|---|---|
committer | epochqwert <epoch@hacking.allowed.org> | 2015-03-31 12:54:01 -0500 |
commit | 5fc8d2a2fbbe55fb3f92c4edd216f9e96d21a288 (patch) | |
tree | 8aecb5ad9887edf3d5261ebe0cc5f2263497fa87 /hashtable.h | |
download | libhashtable-5fc8d2a2fbbe55fb3f92c4edd216f9e96d21a288.tar.gz libhashtable-5fc8d2a2fbbe55fb3f92c4edd216f9e96d21a288.zip |
init commit after splitting from segfault
Diffstat (limited to 'hashtable.h')
-rw-r--r-- | hashtable.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/hashtable.h b/hashtable.h new file mode 100644 index 0000000..a58a392 --- /dev/null +++ b/hashtable.h @@ -0,0 +1,27 @@ +struct entry {//linked list node. + char *original; + void *target; + struct entry *prev;// doubly linked list. why? + struct entry *next; +}; + +struct hitem { + struct entry *ll; +}; + +struct hashtable { + int kl;//number of keys in the table + struct hitem **bucket; + int *keys; +}; +unsigned short hash(char *key);//maybe use a seeded rand()? :) Thanks FreeArtMan +void inittable(struct hashtable *ht,int tsize); +void ll_delete(struct entry *ll); +void ll_destroy(struct entry *ll); +void ht_destroy(struct hashtable *ht); +void ht_freevalues(struct hashtable *ht); +int ht_setkey(struct hashtable *ht,char *key,void *value); +struct entry *ll_getentry(struct entry *start,char *msg); +struct entry *ht_getentry(struct hashtable *ht,char *key); +struct entry *ht_getnode(struct hashtable *ht,char *msg); +void *ht_getvalue(struct hashtable *ht,char *msg); |