stupid segfault...

This commit is contained in:
Enno Rehling 2004-01-15 22:13:45 +00:00
parent 0dce9060e9
commit 7ced18cfef
1 changed files with 2 additions and 2 deletions

View File

@ -231,7 +231,7 @@ cursetype_list * cursetypes[CMAXHASH];
void void
ct_register(const curse_type * ct) ct_register(const curse_type * ct)
{ {
unsigned int hash = hashstring(ct->cname); unsigned int hash = hashstring(ct->cname) % CMAXHASH;
cursetype_list ** ctlp = &cursetypes[hash]; cursetype_list ** ctlp = &cursetypes[hash];
while (*ctlp) { while (*ctlp) {
cursetype_list * ctl = *ctlp; cursetype_list * ctl = *ctlp;
@ -245,7 +245,7 @@ ct_register(const curse_type * ct)
const curse_type * const curse_type *
ct_find(const char *c) ct_find(const char *c)
{ {
unsigned int hash = hashstring(c); unsigned int hash = hashstring(c) % CMAXHASH;
cursetype_list * ctl = cursetypes[hash]; cursetype_list * ctl = cursetypes[hash];
while (ctl) { while (ctl) {
int k = min(strlen(c), strlen(ctl->type->cname)); int k = min(strlen(c), strlen(ctl->type->cname));