summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-03-26 19:32:24 +0000
committerache <ache@FreeBSD.org>1995-03-26 19:32:24 +0000
commit04eca1b0efb7d079ad45248b607476ecde7e18b2 (patch)
tree5c28d46939e692f7ba40d90f92b110bc8ccacebb /lib
parent53fcf3427fb69c307b5b6f854089d6ea9b0c5513 (diff)
downloadFreeBSD-src-04eca1b0efb7d079ad45248b607476ecde7e18b2.zip
FreeBSD-src-04eca1b0efb7d079ad45248b607476ecde7e18b2.tar.gz
Hash 8bit chars without sign extension
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/strhash.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libc/stdlib/strhash.c b/lib/libc/stdlib/strhash.c
index 04a97d6..77d8ac9 100644
--- a/lib/libc/stdlib/strhash.c
+++ b/lib/libc/stdlib/strhash.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char *rcsid = "$Header: /home/ncvs/src/usr.bin/dmenu/hash.c,v 1.1 1995/02/25 02:16:34 jkh Exp $";
+static char *rcsid = "$Header: /home/ncvs/src/lib/libc/stdlib/strhash.c,v 1.1 1995/03/26 10:21:55 jkh Exp $";
#endif
/*
@@ -36,7 +36,12 @@ static char *rcsid = "$Header: /home/ncvs/src/usr.bin/dmenu/hash.c,v 1.1 1995/02
*/
/*
- * $Log: hash.c,v $
+ * $Log: strhash.c,v $
+ * Revision 1.1 1995/03/26 10:21:55 jkh
+ * Add the strhash family of routines. They provide a number of features
+ * that the db/hash functions don't, and they're much simpler to use for
+ * low-overhead string hashing.
+ *
* Revision 1.1 1995/02/25 02:16:34 jkh
* Second version of this - now support the essentials of a basic
* attributed file system for storing menu information and command
@@ -156,7 +161,7 @@ _hash(int size, char *key)
unsigned int h = 0x0;
while (*key){
- h = (h << 1) ^ (h ^ *key++);
+ h = (h << 1) ^ (h ^ (unsigned char) *key++);
}
h %= size;
OpenPOWER on IntegriCloud