From: michael Date: Mon, 29 Dec 2014 14:58:35 +0000 (+0000) Subject: - irc.c:irc_parse(): minor cleanups X-Git-Tag: 1.1.0beta1~252 X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=282262e6d4becce948285c82e9d302cf5a3ad409;p=hopm.git - irc.c:irc_parse(): minor cleanups git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5191 82007160-df01-0410-b94d-b575c5fd34c7 --- diff --git a/src/irc.c b/src/irc.c index f3065d9..572c243 100644 --- a/src/irc.c +++ b/src/irc.c @@ -128,7 +128,8 @@ static struct CommandHash COMMAND_TABLE[] = { "473", m_cannot_join }, { "474", m_cannot_join }, { "475", m_cannot_join }, - { "KILL", m_kill } + { "KILL", m_kill }, + { NULL, NULL } }; /* irc_cycle @@ -514,11 +515,9 @@ irc_parse(void) * parv[0] is ALWAYS the source, and is the server name of the source * did not exist */ - static char *parv[17]; - static unsigned int parc; - static char msg[MSGLENMAX]; /* Temporarily stores IRC msg to pass to handlers */ - - parc = 1; + char *parv[17]; + unsigned int parc = 1; + char msg[MSGLENMAX]; /* Temporarily stores IRC msg to pass to handlers */ if (IRC_RAW_LEN == 0) return; @@ -575,11 +574,11 @@ irc_parse(void) * Determine which command this is from the command table * and let the handler for that command take control */ - for (unsigned int i = 0; i < (sizeof(COMMAND_TABLE) / sizeof(struct CommandHash)); ++i) + for (const struct CommandHash *cmd = COMMAND_TABLE; cmd->command; ++cmd) { - if (strcasecmp(COMMAND_TABLE[i].command, parv[1]) == 0) + if (strcasecmp(cmd->command, parv[1]) == 0) { - (*COMMAND_TABLE[i].handler)(parv, parc, msg, source_p); + cmd->handler(parv, parc, msg, source_p); break; } }