summaryrefslogtreecommitdiffstats
path: root/include/strhash.h
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-03-26 10:12:53 +0000
committerjkh <jkh@FreeBSD.org>1995-03-26 10:12:53 +0000
commit00fee885a61fb4de883f0a94ae38b8d9971d7439 (patch)
tree6aff342a802afbd62673ff705b057dd4552c2261 /include/strhash.h
parente0abbde8cf65bc85c00329f124c29ebadabca1a4 (diff)
downloadFreeBSD-src-00fee885a61fb4de883f0a94ae38b8d9971d7439.zip
FreeBSD-src-00fee885a61fb4de883f0a94ae38b8d9971d7439.tar.gz
add strhash.h for libc's new string hashing function.
Diffstat (limited to 'include/strhash.h')
-rw-r--r--include/strhash.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/include/strhash.h b/include/strhash.h
new file mode 100644
index 0000000..97e50a8
--- /dev/null
+++ b/include/strhash.h
@@ -0,0 +1,64 @@
+#ifndef _STRHASH_H_INCLUDE
+#define _STRHASH_H_INCLUDE
+
+/* $Header: /home/ncvs/src/usr.bin/dmenu/hash.h,v 1.2 1995/03/21 06:39:04 jkh Exp $ */
+
+/*
+ *
+ * Copyright 1990
+ * Terry Jones & Jordan Hubbard
+ *
+ * PCS Computer Systeme, GmbH.
+ * Munich, West Germany
+ *
+ *
+ * All rights reserved.
+ *
+ * This is unsupported software and is subject to change without notice.
+ * the author makes no representations about the suitability of this software
+ * for any purpose. It is supplied "as is" without express or implied
+ * warranty.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the author not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission.
+ *
+ */
+
+/*
+ * This is the definition file for hash.c. The plunderer from down-under
+ * did the code, I just helped define the spec. That's why his name gets
+ * to go first.
+ */
+
+#define HASH_SZ 97
+
+typedef struct _node {
+ char *key;
+ void *data;
+ struct _node *next;
+} hash_node;
+
+typedef struct {
+ int size;
+ hash_node **buckets;
+} hash_table;
+
+hash_table *hash_create(int size);
+void hash_destroy(hash_table *table, char *key,
+ void (*nukefunc)(char *k, void *d));
+void *hash_search(hash_table *table, char *key, void *datum,
+ void (*replace_func)(void *d));
+void hash_traverse(hash_table *table,
+ int (*func)(char *k, void *d, void *arg), void *arg);
+void hash_purge(hash_table *table, void (*purge_func)(char *k, void *d));
+
+#ifdef HASH_STATS
+extern void hash_stats();
+#endif
+
+#endif /* _STRHASH_H_INCLUDE */
OpenPOWER on IntegriCloud