summaryrefslogtreecommitdiff
path: root/libhashtable/hashtable.h
diff options
context:
space:
mode:
authorEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-11-08 00:28:58 -0600
committerEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-11-08 00:28:58 -0600
commitac52abea6b304ee2b7ac4a9718f63fb683adab2b (patch)
tree0801e600272563efd8f81dd32aac815f16322744 /libhashtable/hashtable.h
parentdf553e722fc97af5179bbcaee2ee0c97a45a61db (diff)
downloadsegfault-ac52abea6b304ee2b7ac4a9718f63fb683adab2b.tar.gz
segfault-ac52abea6b304ee2b7ac4a9718f63fb683adab2b.zip
added some deletion stuff to libhashtable and made segfault have a couple
function to delete his two hashtables and reinitialize them. they aren't builtins as default but can be added with !builtin. :)
Diffstat (limited to 'libhashtable/hashtable.h')
-rw-r--r--libhashtable/hashtable.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/libhashtable/hashtable.h b/libhashtable/hashtable.h
index f0e2a15..a58a392 100644
--- a/libhashtable/hashtable.h
+++ b/libhashtable/hashtable.h
@@ -1,21 +1,25 @@
-struct entry {/*linked list node.*/
+struct entry {//linked list node.
char *original;
void *target;
- struct entry *prev;/* doubly linked list. why? */
+ struct entry *prev;// doubly linked list. why?
struct entry *next;
};
-struct hitem {/*dunno why I don't just have this as a linked list. */
+struct hitem {
struct entry *ll;
};
struct hashtable {
- int kl;/*number of keys in the table*/
+ 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*/
+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);