Use cmd_find_clear_state instead of an extra function doing the same.

This commit is contained in:
nicm
2015-12-14 23:30:58 +00:00
parent a585a1b81a
commit d5999f8b5c
3 changed files with 6 additions and 20 deletions

20
cmd.c
View File

@ -388,22 +388,6 @@ usage:
return (NULL);
}
static void
cmd_clear_state(struct cmd_state *state)
{
state->c = NULL;
state->tflag.s = NULL;
state->tflag.wl = NULL;
state->tflag.wp = NULL;
state->tflag.idx = -1;
state->sflag.s = NULL;
state->sflag.wl = NULL;
state->sflag.wp = NULL;
state->sflag.idx = -1;
}
static int
cmd_prepare_state_flag(struct cmd_find_state *fs, enum cmd_entry_flag flag,
const char *target, struct cmd_q *cmdq)
@ -493,7 +477,9 @@ cmd_prepare_state(struct cmd *cmd, struct cmd_q *cmdq)
log_debug("preparing state for %s (client %p)", tmp, cmdq->client);
free(tmp);
cmd_clear_state(state);
state->c = NULL;
cmd_find_clear_state(&state->tflag, NULL, 0);
cmd_find_clear_state(&state->sflag, NULL, 0);
flag = cmd->entry->cflag;
if (flag == CMD_NONE) {