From bf6994d8e3dde638ced26f4e1ae850422631ee72 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 7 Sep 2008 19:15:45 +0200 Subject: command: don't pass permission as pointer where appropriate Some functions don't want to modify a client's permission set. Pass the permissions to them by value, not by reference. --- src/command.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/command.c b/src/command.c index ef151a872..381efad68 100644 --- a/src/command.c +++ b/src/command.c @@ -153,7 +153,7 @@ static const char check_non_negative[] = "\"%s\" is not an integer >= 0"; static const char *current_command; static int command_listNum; -static CommandEntry *getCommandEntryFromString(char *string, int *permission); +static CommandEntry *getCommandEntryFromString(char *string, int permission); static List *commandList; @@ -833,7 +833,7 @@ static int listHandleUpdate(struct client *client, insertInList(pathList, "", NULL); if (next) - nextCmd = getCommandEntryFromString(next->data, permission); + nextCmd = getCommandEntryFromString(next->data, *permission); if (cmd != nextCmd) { int ret = updateInit(pathList); @@ -1418,7 +1418,7 @@ static int checkArgcAndPermission(CommandEntry * cmd, struct client *client, } static CommandEntry *getCommandEntryAndCheckArgcAndPermission(struct client *client, - int *permission, + int permission, int argc, char *argv[]) { @@ -1439,14 +1439,14 @@ static CommandEntry *getCommandEntryAndCheckArgcAndPermission(struct client *cli current_command = cmd->cmd; - if (checkArgcAndPermission(cmd, client, *permission, argc, argv) < 0) { + if (checkArgcAndPermission(cmd, client, permission, argc, argv) < 0) { return NULL; } return cmd; } -static CommandEntry *getCommandEntryFromString(char *string, int *permission) +static CommandEntry *getCommandEntryFromString(char *string, int permission) { CommandEntry *cmd; char *argv[COMMAND_ARGV_MAX] = { NULL }; @@ -1475,7 +1475,7 @@ static int processCommandInternal(struct client *client, if (argc == 0) return 0; - if ((cmd = getCommandEntryAndCheckArgcAndPermission(client, permission, + if ((cmd = getCommandEntryAndCheckArgcAndPermission(client, *permission, argc, argv))) { if (!cmdnode || !cmd->listHandler) { ret = cmd->handler(client, permission, argc, argv); -- cgit v1.2.3