diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-26 04:53:49 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-26 04:53:49 +0800 |
commit | 4a8851c2a5cb962eb43db0ad0eeb06e82974d6a6 (patch) | |
tree | 57c1c373f642e506a0bd66111e099f204b158383 /mbbsd/cache.c | |
parent | 3b64a185e87fdfd39db71bca063b6efb0c7ec92e (diff) | |
download | pttbbs-4a8851c2a5cb962eb43db0ad0eeb06e82974d6a6.tar pttbbs-4a8851c2a5cb962eb43db0ad0eeb06e82974d6a6.tar.gz pttbbs-4a8851c2a5cb962eb43db0ad0eeb06e82974d6a6.tar.bz2 pttbbs-4a8851c2a5cb962eb43db0ad0eeb06e82974d6a6.tar.lz pttbbs-4a8851c2a5cb962eb43db0ad0eeb06e82974d6a6.tar.xz pttbbs-4a8851c2a5cb962eb43db0ad0eeb06e82974d6a6.tar.zst pttbbs-4a8851c2a5cb962eb43db0ad0eeb06e82974d6a6.zip |
fix HASH_BITS checking condition.
suggest to use bigger value if MAX_USERS is quite large.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2550 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/cache.c')
-rw-r--r-- | mbbsd/cache.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 4345e282..493b9b91 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -150,9 +150,6 @@ add_to_uhash(int n, char *id) int *p, h = StringHash(id)%(1<<HASH_BITS); int times; strlcpy(SHM->userid[n], id, sizeof(SHM->userid[n])); -#if (1<<HASH_BITS)*2 < MAX_USERS -#error "HASH_BITS too small" -#endif p = &(SHM->hash_head[h]); @@ -186,6 +183,10 @@ remove_from_uhash(int n) *p = SHM->next_in_hash[n]; } +#if (1<<HASH_BITS)*10 < MAX_USERS +#warning "Suggest to use bigger HASH_BITS for better searchuser() performance," +#warning "searchuser() average chaining MAX_USERS/(1<<HASH_BITS) times." +#endif int searchuser(char *userid) { |