enumerated types for irc.c
The irc section gets an enumerated type for constant values.
This makes the code more readable and less error prone.
committer: Markus Bröker <mbroeker@largo.homelinux.org>
--- a/src/irc.c
+++ b/src/irc.c
@@ -21,7 +21,7 @@
#include <irc.h>
#include "common.h"
-enum {
+enum command_map {
NOTICE, MODE, JOIN, PART, TOPIC, PING, ENOMEM, ERROR, VERSION, PRIVMSG, QUIT, NICK, KICK
};
@@ -189,16 +189,16 @@
*/
char *irc_parsemessage (const char *line, MSG * message)
{
- int i;
+ enum command_map map;
char *command;
char *ptr;
int value;
- i = 0;
+ map = 0;
if ((command = irc_getmessage (line, message)) != NULL) {
- while (IRC_Commands[i] != NULL) {
- if (strcmp (IRC_Commands[i], command) == 0) {
- switch (i) {
+ while (IRC_Commands[map] != NULL) {
+ if (strcmp (IRC_Commands[map], command) == 0) {
+ switch (map) {
case NOTICE:
if (message->line == NULL) {
message->channel = "*";
@@ -270,7 +270,7 @@
return command;
}
}
- i++;
+ map++;
}
if ((value = atoi (command)) != 0) {