From: Ari Johnson Date: Wed, 11 May 2011 04:44:32 +0000 (-0400) Subject: Make chook_mevents and chook_htab hashtabs case-insensitive X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=2f5e0ef5333517239ae5453ce32d223301883081;p=cobramush.git Make chook_mevents and chook_htab hashtabs case-insensitive --- diff --git a/src/modules.c b/src/modules.c index 7ddb0e7..eaf7ed2 100644 --- a/src/modules.c +++ b/src/modules.c @@ -78,7 +78,7 @@ CHooks_Init() hashinit(&chook_mevents, sz); for (sz = i = 0; chook_tab[i].key != NULL; i++) if (chook_tab[i].mush_key != NULL) - hashadd(chook_tab[i].mush_key, (void *) chook_tab[i].key, &chook_mevents); + hashadd(strupper(chook_tab[i].mush_key), (void *) chook_tab[i].key, &chook_mevents); } struct core_hook_t * @@ -87,7 +87,7 @@ CHook_Create(const char *key, int flags) struct core_hook_t *chook; /* check to see if we need to create it */ - if ((chook = (struct core_hook_t *) hashfind(key, &chook_htab))) { + if ((chook = (struct core_hook_t *) hashfind(strupper(key), &chook_htab))) { /* It already exists.. just return this one */ return chook; } @@ -103,7 +103,7 @@ CHook_Create(const char *key, int flags) chook->flags = flags; chook->hooks = NULL; /* Initialized as having no children */ /* Add to the hashtab */ - hashadd(key, chook, &chook_htab); + hashadd(strupper(key), chook, &chook_htab); return chook; } @@ -115,7 +115,7 @@ CHook_Insert(const char *key, char priority, int flags, void *data) struct core_entry_t *new_child, *cur_child; /* Ok first look for the htab entry */ - parent = hashfind(key, &chook_htab); + parent = hashfind(strupper(key), &chook_htab); if (!parent) /* It doesn't exist, return NULL */ return NULL; @@ -218,7 +218,7 @@ COMMAND(cmd_event) } /* Look for event */ - if (!(key = (char *) hashfind(arg_left, &chook_mevents))) { + if (!(key = (char *) hashfind(strupper(arg_left), &chook_mevents))) { notify(player, "No such event."); return; }