summaryrefslogtreecommitdiffstats
path: root/mbbsd/stuff.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-02-26 04:14:25 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-02-26 04:14:25 +0800
commit3b64a185e87fdfd39db71bca063b6efb0c7ec92e (patch)
tree8678540a15b6a541d21f176ab46dbeb48d6cdfde /mbbsd/stuff.c
parent58490fa9b998ccd714de75f48a9c1eb5f914995d (diff)
downloadpttbbs-3b64a185e87fdfd39db71bca063b6efb0c7ec92e.tar
pttbbs-3b64a185e87fdfd39db71bca063b6efb0c7ec92e.tar.gz
pttbbs-3b64a185e87fdfd39db71bca063b6efb0c7ec92e.tar.bz2
pttbbs-3b64a185e87fdfd39db71bca063b6efb0c7ec92e.tar.lz
pttbbs-3b64a185e87fdfd39db71bca063b6efb0c7ec92e.tar.xz
pttbbs-3b64a185e87fdfd39db71bca063b6efb0c7ec92e.tar.zst
pttbbs-3b64a185e87fdfd39db71bca063b6efb0c7ec92e.zip
* use fnv hash function for all hash.
* add version field in SHM. * clean up & reorder SHM, add gaps between arrays. * enlarge USHM_SIZE. * remove unused shmsweep.c. * WARNING, you need to stop bbs and clean old shm before run this revision. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2549 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/stuff.c')
-rw-r--r--mbbsd/stuff.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index 2ea16fec..3d3b90f8 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -1,5 +1,6 @@
/* $Id$ */
#include "bbs.h"
+#include "fnv_hash.h"
/* ----------------------------------------------------- */
/* set file path for boards/user home */
@@ -895,12 +896,7 @@ void FREE(void *ptr)
unsigned
StringHash(unsigned char *s)
{
- unsigned int v = 0;
- while (*s) {
- v = (v << 8) | (v >> 24);
- v ^= toupper(*s++); /* note this is case insensitive */
- }
- return (v * 2654435769U) >> (32 - HASH_BITS);
+ return fnv1a_32_strcase(s, FNV1_32_INIT);
}
inline int *intbsearch(int key, int *base0, int nmemb)