summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-10-27 22:52:15 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-10-27 22:52:15 +0000
commit5f16c953ae26aee0c7beb4b45465602e0d1135ea (patch)
tree6d4bfe434c77422be5dcc057163e611728b84888 /src/include
parentb427c5646986576cbdf5f2cd2e65e861560bec0f (diff)
Collision chaining hash tables.
Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1115 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Hash.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/include/Hash.h b/src/include/Hash.h
new file mode 100644
index 00000000..aee1095f
--- /dev/null
+++ b/src/include/Hash.h
@@ -0,0 +1,71 @@
+ /*@@
+ @header Hash.h
+ @date Wed Oct 27 23:28:53 1999
+ @author Tom Goodale
+ @desc
+ Header file for hash stuff.
+ @enddesc
+ @version $Header$
+ @@*/
+
+#ifndef _HASH_H_
+#define _HASH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct T_HASH_ENTRY
+{
+ struct T_HASH_ENTRY *last;
+ struct T_HASH_ENTRY *next;
+
+ unsigned int hash;
+
+ unsigned int klen;
+ char *key;
+
+ void *data;
+} t_hash_entry;
+
+typedef struct T_HASH
+{
+ unsigned int size;
+ unsigned int fill;
+ unsigned int keys;
+
+ t_hash_entry **array;
+} t_hash;
+
+t_hash *HashCreate(unsigned int initial_size);
+void HashDestroy(t_hash *hash);
+
+int HashStore(t_hash *hash,
+ unsigned int klen,
+ char *key,
+ unsigned int hashval,
+ void *data);
+
+int HashAdd(t_hash *hash,
+ unsigned int klen,
+ char *key,
+ unsigned int hashval,
+ void *data);
+
+int HashDelete(t_hash *hash,
+ unsigned int klen,
+ char *key, unsigned int hashval);
+
+void *HashGet(t_hash *hash,
+ unsigned int klen,
+ char *key,
+ unsigned int hashval);
+
+unsigned int HashHash(unsigned int klen,
+ char *key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _HASH_H_ */