From b342bd0b462f69a9fc9a59d52bcd4bb34b57114f Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 16 Oct 2016 19:04:05 +0000 Subject: Mass rename struct cmd_q to struct cmdq_item and related. --- cmd-if-shell.c | 66 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'cmd-if-shell.c') diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 7192b204..5dfb5a19 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -29,11 +29,11 @@ * Executes a tmux command if a shell command returns true or false. */ -static enum cmd_retval cmd_if_shell_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_if_shell_exec(struct cmd *, struct cmdq_item *); -static enum cmd_retval cmd_if_shell_error(struct cmd_q *, void *); -static void cmd_if_shell_callback(struct job *); -static void cmd_if_shell_free(void *); +static enum cmd_retval cmd_if_shell_error(struct cmdq_item *, void *); +static void cmd_if_shell_callback(struct job *); +static void cmd_if_shell_free(void *); const struct cmd_entry cmd_if_shell_entry = { .name = "if-shell", @@ -57,33 +57,33 @@ struct cmd_if_shell_data { char *cmd_else; struct client *client; - struct cmd_q *cmdq; + struct cmdq_item *item; struct mouse_event mouse; }; static enum cmd_retval -cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) +cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = self->args; struct cmd_if_shell_data *cdata; char *shellcmd, *cmd, *cause; struct cmd_list *cmdlist; - struct cmd_q *new_cmdq; - struct session *s = cmdq->state.tflag.s; - struct winlink *wl = cmdq->state.tflag.wl; - struct window_pane *wp = cmdq->state.tflag.wp; + struct cmdq_item *new_item; + struct session *s = item->state.tflag.s; + struct winlink *wl = item->state.tflag.wl; + struct window_pane *wp = item->state.tflag.wp; struct format_tree *ft; const char *cwd; - if (cmdq->client != NULL && cmdq->client->session == NULL) - cwd = cmdq->client->cwd; + if (item->client != NULL && item->client->session == NULL) + cwd = item->client->cwd; else if (s != NULL) cwd = s->cwd; else cwd = NULL; - ft = format_create(cmdq, 0); - format_defaults(ft, cmdq->state.c, s, wl, wp); + ft = format_create(item, 0); + format_defaults(ft, item->state.c, s, wl, wp); shellcmd = format_expand(ft, args->argv[0]); format_free(ft); @@ -98,13 +98,13 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); if (cmd_string_parse(cmd, &cmdlist, NULL, 0, &cause) != 0) { if (cause != NULL) { - cmdq_error(cmdq, "%s", cause); + cmdq_error(item, "%s", cause); free(cause); } return (CMD_RETURN_ERROR); } - new_cmdq = cmdq_get_command(cmdlist, NULL, &cmdq->mouse, 0); - cmdq_insert_after(cmdq, new_cmdq); + new_item = cmdq_get_command(cmdlist, NULL, &item->mouse, 0); + cmdq_insert_after(item, new_item); cmd_list_free(cmdlist); return (CMD_RETURN_NORMAL); } @@ -121,14 +121,14 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) else cdata->cmd_else = NULL; - cdata->client = cmdq->client; + cdata->client = item->client; cdata->client->references++; if (!args_has(args, 'b')) - cdata->cmdq = cmdq; + cdata->item = item; else - cdata->cmdq = NULL; - memcpy(&cdata->mouse, &cmdq->mouse, sizeof cdata->mouse); + cdata->item = NULL; + memcpy(&cdata->mouse, &item->mouse, sizeof cdata->mouse); job_run(shellcmd, s, cwd, cmd_if_shell_callback, cmd_if_shell_free, cdata); @@ -140,11 +140,11 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) } static enum cmd_retval -cmd_if_shell_error(struct cmd_q *cmdq, void *data) +cmd_if_shell_error(struct cmdq_item *item, void *data) { char *error = data; - cmdq_error(cmdq, "%s", error); + cmdq_error(item, "%s", error); free(error); return (CMD_RETURN_NORMAL); @@ -156,7 +156,7 @@ cmd_if_shell_callback(struct job *job) struct cmd_if_shell_data *cdata = job->data; struct client *c = cdata->client; struct cmd_list *cmdlist; - struct cmd_q *new_cmdq; + struct cmdq_item *new_item; char *cause, *cmd, *file = cdata->file; u_int line = cdata->line; @@ -169,24 +169,24 @@ cmd_if_shell_callback(struct job *job) if (cmd_string_parse(cmd, &cmdlist, file, line, &cause) != 0) { if (cause != NULL) - new_cmdq = cmdq_get_callback(cmd_if_shell_error, cause); + new_item = cmdq_get_callback(cmd_if_shell_error, cause); else - new_cmdq = NULL; + new_item = NULL; } else { - new_cmdq = cmdq_get_command(cmdlist, NULL, &cdata->mouse, 0); + new_item = cmdq_get_command(cmdlist, NULL, &cdata->mouse, 0); cmd_list_free(cmdlist); } - if (new_cmdq != NULL) { - if (cdata->cmdq == NULL) - cmdq_append(c, new_cmdq); + if (new_item != NULL) { + if (cdata->item == NULL) + cmdq_append(c, new_item); else - cmdq_insert_after(cdata->cmdq, new_cmdq); + cmdq_insert_after(cdata->item, new_item); } out: - if (cdata->cmdq != NULL) - cdata->cmdq->flags &= ~CMD_Q_WAITING; + if (cdata->item != NULL) + cdata->item->flags &= ~CMDQ_WAITING; } static void -- cgit v1.2.3