diff options
author | Max Kellermann <max@duempel.org> | 2008-10-22 09:58:13 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-22 09:58:13 +0200 |
commit | 4b4f7df93383d6e8c9c579d21aa5fa33c38287db (patch) | |
tree | 7f99d27ccd8235cad562161379e956ef64d21b23 /src/command.c | |
parent | e6d90d4e83263c37bbee878aed782bf13669daa1 (diff) | |
download | mpd-4b4f7df93383d6e8c9c579d21aa5fa33c38287db.tar.gz mpd-4b4f7df93383d6e8c9c579d21aa5fa33c38287db.tar.xz mpd-4b4f7df93383d6e8c9c579d21aa5fa33c38287db.zip |
command: renamed CommandEntry to struct command
No CamelCase and no struct typedefs.
Diffstat (limited to 'src/command.c')
-rw-r--r-- | src/command.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/command.c b/src/command.c index 0eb285dfc..a13a00250 100644 --- a/src/command.c +++ b/src/command.c @@ -128,13 +128,11 @@ */ #define COMMAND_ARGV_MAX (2+(TAG_NUM_OF_ITEM_TYPES*2)) -typedef struct _CommandEntry CommandEntry; - typedef int (*CommandHandlerFunction) (struct client *, int, char **); /* if min: -1 don't check args * * if max: -1 no max args */ -struct _CommandEntry { +struct command { const char *cmd; int min; int max; @@ -277,7 +275,7 @@ static void addCommand(const char *name, int maxargs, CommandHandlerFunction handler_func) { - CommandEntry *cmd = xmalloc(sizeof(CommandEntry)); + struct command *cmd = xmalloc(sizeof(*cmd)); cmd->cmd = name; cmd->min = minargs; cmd->max = maxargs; @@ -1194,10 +1192,10 @@ static int handleCommands(struct client *client, { const unsigned permission = client_get_permission(client); ListNode *node = commandList->firstNode; - CommandEntry *cmd; + struct command *cmd; while (node != NULL) { - cmd = (CommandEntry *) node->data; + cmd = (struct command *) node->data; if (cmd->reqPermission == (permission & cmd->reqPermission)) { client_printf(client, "command: %s\n", cmd->cmd); } @@ -1213,10 +1211,10 @@ static int handleNotcommands(struct client *client, { const unsigned permission = client_get_permission(client); ListNode *node = commandList->firstNode; - CommandEntry *cmd; + struct command *cmd; while (node != NULL) { - cmd = (CommandEntry *) node->data; + cmd = (struct command *) node->data; if (cmd->reqPermission != (permission & cmd->reqPermission)) { client_printf(client, "command: %s\n", cmd->cmd); @@ -1347,7 +1345,7 @@ void finishCommands(void) freeList(commandList); } -static int checkArgcAndPermission(CommandEntry * cmd, struct client *client, +static int checkArgcAndPermission(struct command *cmd, struct client *client, unsigned permission, int argc, char *argv[]) { int min = cmd->min + 1; @@ -1384,13 +1382,13 @@ static int checkArgcAndPermission(CommandEntry * cmd, struct client *client, return 0; } -static CommandEntry *getCommandEntryAndCheckArgcAndPermission(struct client *client, +static struct command *getCommandEntryAndCheckArgcAndPermission(struct client *client, unsigned permission, int argc, char *argv[]) { static char unknown[] = ""; - CommandEntry *cmd; + struct command *cmd; current_command = unknown; @@ -1417,7 +1415,7 @@ int processCommand(struct client *client, char *commandString) { int argc; char *argv[COMMAND_ARGV_MAX] = { NULL }; - CommandEntry *cmd; + struct command *cmd; int ret = -1; if (!(argc = buffer2array(commandString, argv, COMMAND_ARGV_MAX))) |