summaryrefslogtreecommitdiff
path: root/libhashtable/hashtable.h
diff options
context:
space:
mode:
authorEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-09-07 02:53:24 -0500
committerEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-09-07 02:53:24 -0500
commit9b8d802ca89027de46ee45fbc9adf978a16e7927 (patch)
treea7795bd687719df809f307ea4dd553a25ccbecda /libhashtable/hashtable.h
parentf41ec6d42942f994f762486a9ab525ed8c5506e5 (diff)
downloadsegfault-9b8d802ca89027de46ee45fbc9adf978a16e7927.tar.gz
segfault-9b8d802ca89027de46ee45fbc9adf978a16e7927.zip
small fix with libhashtable's header
Diffstat (limited to 'libhashtable/hashtable.h')
-rw-r--r--libhashtable/hashtable.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/libhashtable/hashtable.h b/libhashtable/hashtable.h
new file mode 100644
index 0000000..820d230
--- /dev/null
+++ b/libhashtable/hashtable.h
@@ -0,0 +1,23 @@
+struct entry {//linked list node.
+ char *original;
+ char *target;
+ 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 entry *ll;
+};
+
+struct hashtable {
+ int kl;//number of keys in the table
+ struct hitem **bucket;
+ int *keys;
+};
+unsigned short hash(char *v);//maybe use a seeded rand()? :) Thanks FreeArtMan
+void inittable(struct hashtable *ht,int tsize);
+int ht_setkey(struct hashtable *ht,char *key,char *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);
+char *ht_getvalue(struct hashtable *ht,char *msg);