X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/b37021a45e15eef2e937aa11f185b48cf766d772..91e46e62e5f9faf6735e0c41ce21113939cacb85:/src/hash.c diff --git a/src/hash.c b/src/hash.c index f10c5ae..9ff4b12 100644 --- a/src/hash.c +++ b/src/hash.c @@ -46,7 +46,6 @@ dlink_list *channelTable; dlink_list *idTable; dlink_list *resvTable; dlink_list *hostTable; -dlink_list *helpTable; /* * look in whowas.c for the missing ...[WW_MAX]; entry @@ -97,7 +96,6 @@ init_hash(void) channelTable = MyMalloc(sizeof(dlink_list) * CH_MAX); hostTable = MyMalloc(sizeof(dlink_list) * HOST_MAX); resvTable = MyMalloc(sizeof(dlink_list) * R_MAX); - helpTable = MyMalloc(sizeof(dlink_list) * HELP_MAX); } #ifndef RICER_HASHING @@ -111,7 +109,8 @@ fnv_hash_upper(const unsigned char *s, int bits) h ^= ToUpper(*s++); h += (h<<1) + (h<<4) + (h<<7) + (h << 8) + (h << 24); } - h = (h >> bits) ^ (h & ((2^bits)-1)); + if (bits < 32) + h = ((h >> bits) ^ h) & ((1<> bits) ^ (h & ((2^bits)-1)); + if (bits < 32) + h = ((h >> bits) ^ h) & ((1<> bits) ^ (h & ((2^bits)-1)); + if (bits < 32) + h = ((h >> bits) ^ h) & ((1<> bits) ^ (h & ((2^bits)-1)); + if (bits < 32) + h = ((h >> bits) ^ h) & ((1<data); - dlinkDestroy(ptr, &helpTable[i]); - } - HASH_WALK_END -} - /* find_id() * * finds a client entry from the id hash table @@ -678,30 +640,6 @@ hash_find_resv(const char *name) return NULL; } -struct cachefile * -hash_find_help(const char *name, int flags) -{ - struct cachefile *hptr; - dlink_node *ptr; - unsigned int hashv; - - if(EmptyString(name)) - return NULL; - - hashv = hash_help(name); - - DLINK_FOREACH(ptr, helpTable[hashv].head) - { - hptr = ptr->data; - - if((irccmp(name, hptr->name) == 0) && - (hptr->flags & flags)) - return hptr; - } - - return NULL; -} - void clear_resv_hash(void) {