]> mj.ucw.cz Git - libucw.git/blob - lib/hash-string.c
bungetc() is no longer passed the character to unget -- it always ungets
[libucw.git] / lib / hash-string.c
1 /*
2  *      Sherlock Library -- String Hash Function
3  *
4  *      (c) 2002 Martin Mares <mj@ucw.cz>
5  */
6
7 #include "lib/lib.h"
8 #include "lib/hashfunc.h"
9
10 #include <string.h>
11
12 uns
13 hash_string(byte *k)
14 {
15   uns h = strlen(k);
16   while (*k)
17     h = h*37 + *k++;
18   return h;
19 }