dlink_list *channelTable;
dlink_list *idTable;
dlink_list *resvTable;
-dlink_list *hostTable;
-dlink_list *helpTable;
-dlink_list *ndTable;
+dlink_list *hostTable;
/*
* look in whowas.c for the missing ...[WW_MAX]; entry
{
clientTable = MyMalloc(sizeof(dlink_list) * U_MAX);
idTable = MyMalloc(sizeof(dlink_list) * U_MAX);
- ndTable = MyMalloc(sizeof(dlink_list) * U_MAX);
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
return fnv_hash_upper_len((const unsigned char *) name, R_MAX_BITS, 30);
}
-static unsigned int
-hash_help(const char *name)
-{
- unsigned int h = 0;
-
- while(*name)
- {
- h += (unsigned int) (ToLower(*name++) & 0xDF);
- }
-
- return (h % HELP_MAX);
-}
-
/* add_to_id_hash()
*
* adds an entry to the id hash table
dlinkAddAlloc(aconf, &resvTable[hashv]);
}
-void
-add_to_help_hash(const char *name, struct cachefile *hptr)
-{
- unsigned int hashv;
-
- if(EmptyString(name) || hptr == NULL)
- return;
-
- hashv = hash_help(name);
- dlinkAddAlloc(hptr, &helpTable[hashv]);
-}
-
-void
-add_to_nd_hash(const char *name, struct nd_entry *nd)
-{
- nd->hashv = hash_nick(name);
- dlinkAdd(nd, &nd->hnode, &ndTable[nd->hashv]);
-}
-
/* del_from_id_hash()
*
* removes an id from the id hash table
dlinkFindDestroy(aconf, &resvTable[hashv]);
}
-void
-clear_help_hash(void)
-{
- dlink_node *ptr;
- dlink_node *next_ptr;
- int i;
-
- HASH_WALK_SAFE(i, HELP_MAX, ptr, next_ptr, helpTable)
- {
- free_cachefile(ptr->data);
- dlinkDestroy(ptr, &helpTable[i]);
- }
- HASH_WALK_END
-}
-
/* find_id()
*
* finds a client entry from the id hash table
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)
{
HASH_WALK_END
}
-struct nd_entry *
-hash_find_nd(const char *name)
-{
- struct nd_entry *nd;
- dlink_node *ptr;
- unsigned int hashv;
-
- if(EmptyString(name))
- return NULL;
-
- hashv = hash_nick(name);
-
- DLINK_FOREACH(ptr, ndTable[hashv].head)
- {
- nd = ptr->data;
-
- if(!irccmp(name, nd->name))
- return nd;
- }
-
- return NULL;
-}
-
static void
output_hash(struct Client *source_p, const char *name, int length, int *counts, int deepest)
{