From fb35a00d1da8f6da6a2d5438c5c3324e32147009 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Mon, 29 May 2017 15:54:57 +1000 Subject: [PATCH] Add const to nick pointer passed to find_nicklist_in_channellist() --- include/hash2.h | 2 +- include/modval.h | 2 +- source/hash.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/hash2.h b/include/hash2.h index a8a04e0..e57d142 100644 --- a/include/hash2.h +++ b/include/hash2.h @@ -31,7 +31,7 @@ int BX_remove_oldest_whowas_hashlist (WhowasWrapList *, time_t, int); WhowasList *BX_next_userhost(WhowasWrapList *, WhowasList *); -NickList *BX_find_nicklist_in_channellist(char *, ChannelList *, int); +NickList *BX_find_nicklist_in_channellist(const char *, ChannelList *, int); NickList *BX_next_nicklist(ChannelList *, NickList *); void clear_nicklist_hashtable(ChannelList *); diff --git a/include/modval.h b/include/modval.h index f845ff8..740ee42 100644 --- a/include/modval.h +++ b/include/modval.h @@ -431,7 +431,7 @@ extern Function_ptr *global; #define lookup_channel (*(ChannelList *(*)(const char *, int, int))global[LOOKUP_CHANNEL]) /* hash.c */ -#define find_nicklist_in_channellist (*(NickList *(*)(char *, ChannelList *, int))global[FIND_NICKLIST_IN_CHANNELLIST]) +#define find_nicklist_in_channellist (*(NickList *(*)(const char *, ChannelList *, int))global[FIND_NICKLIST_IN_CHANNELLIST]) #define add_nicklist_to_channellist (*(void (*)(NickList *, ChannelList *))global[ADD_NICKLIST_TO_CHANNELLIST]) #define next_nicklist (*(NickList *(*)(ChannelList *, NickList *))global[NEXT_NICKLIST]) #define next_namelist (*(List *(*)(HashEntry *, List *, unsigned int))global[NEXT_NAMELIST]) diff --git a/source/hash.c b/source/hash.c index 480762d..69a67ce 100644 --- a/source/hash.c +++ b/source/hash.c @@ -203,10 +203,10 @@ void BX_add_nicklist_to_channellist(NickList *nptr, ChannelList *cptr) cptr->NickListTable[hvalue].hits++; } -NickList *BX_find_nicklist_in_channellist(char *nick, ChannelList *cptr, int remove) +NickList *BX_find_nicklist_in_channellist(const char *nick, ChannelList *cptr, int remove) { HashEntry *location; - register NickList *tmp, *prev = NULL; + NickList *tmp, *prev = NULL; unsigned long hvalue = hash_nickname(nick, NICKLIST_HASHSIZE); if (!cptr) @@ -217,7 +217,7 @@ NickList *BX_find_nicklist_in_channellist(char *nick, ChannelList *cptr, int rem * as regular linked list, or as ircd likes to say... * "We found the bucket, now search the chain" */ - for (tmp = (NickList *) location->list; tmp; prev = tmp, tmp = tmp->next) + for (tmp = location->list; tmp; prev = tmp, tmp = tmp->next) { if (!my_stricmp(nick, tmp->nick)) {