aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 19:15:45 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 19:15:45 +0200
commitbf6994d8e3dde638ced26f4e1ae850422631ee72 (patch)
tree77e40b4747be3d6569edb704893fd131e9c73042 /src/command.c
parent18fc10a92647f06aba065b80a4de219facf5d550 (diff)
downloadmpd-bf6994d8e3dde638ced26f4e1ae850422631ee72.tar.gz
mpd-bf6994d8e3dde638ced26f4e1ae850422631ee72.tar.xz
mpd-bf6994d8e3dde638ced26f4e1ae850422631ee72.zip
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.
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c12
1 files 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);