mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 18:38:48 +00:00
There is no need to save the guard state because the function checks it
again anyway.
This commit is contained in:
parent
c9642ee213
commit
e5d9ceff18
15
cmd-queue.c
15
cmd-queue.c
@ -117,20 +117,17 @@ cmdq_error(struct cmd_q *cmdq, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Print a guard line. */
|
/* Print a guard line. */
|
||||||
int
|
void
|
||||||
cmdq_guard(struct cmd_q *cmdq, const char *guard, int flags)
|
cmdq_guard(struct cmd_q *cmdq, const char *guard, int flags)
|
||||||
{
|
{
|
||||||
struct client *c = cmdq->client;
|
struct client *c = cmdq->client;
|
||||||
|
|
||||||
if (c == NULL)
|
if (c == NULL || !(c->flags & CLIENT_CONTROL))
|
||||||
return (0);
|
return;
|
||||||
if (!(c->flags & CLIENT_CONTROL))
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u %d\n", guard,
|
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u %d\n", guard,
|
||||||
(long) cmdq->time, cmdq->number, flags);
|
(long) cmdq->time, cmdq->number, flags);
|
||||||
server_push_stdout(c);
|
server_push_stdout(c);
|
||||||
return (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add command list to queue and begin processing if needed. */
|
/* Add command list to queue and begin processing if needed. */
|
||||||
@ -163,7 +160,7 @@ cmdq_continue(struct cmd_q *cmdq)
|
|||||||
{
|
{
|
||||||
struct cmd_q_item *next;
|
struct cmd_q_item *next;
|
||||||
enum cmd_retval retval;
|
enum cmd_retval retval;
|
||||||
int empty, guard, flags;
|
int empty, flags;
|
||||||
char s[1024];
|
char s[1024];
|
||||||
|
|
||||||
notify_disable();
|
notify_disable();
|
||||||
@ -188,16 +185,14 @@ cmdq_continue(struct cmd_q *cmdq)
|
|||||||
cmdq->number++;
|
cmdq->number++;
|
||||||
|
|
||||||
flags = !!(cmdq->cmd->flags & CMD_CONTROL);
|
flags = !!(cmdq->cmd->flags & CMD_CONTROL);
|
||||||
guard = cmdq_guard(cmdq, "begin", flags);
|
cmdq_guard(cmdq, "begin", flags);
|
||||||
|
|
||||||
retval = cmdq->cmd->entry->exec(cmdq->cmd, cmdq);
|
retval = cmdq->cmd->entry->exec(cmdq->cmd, cmdq);
|
||||||
|
|
||||||
if (guard) {
|
|
||||||
if (retval == CMD_RETURN_ERROR)
|
if (retval == CMD_RETURN_ERROR)
|
||||||
cmdq_guard(cmdq, "error", flags);
|
cmdq_guard(cmdq, "error", flags);
|
||||||
else
|
else
|
||||||
cmdq_guard(cmdq, "end", flags);
|
cmdq_guard(cmdq, "end", flags);
|
||||||
}
|
|
||||||
|
|
||||||
if (retval == CMD_RETURN_ERROR)
|
if (retval == CMD_RETURN_ERROR)
|
||||||
break;
|
break;
|
||||||
|
2
tmux.h
2
tmux.h
@ -1832,7 +1832,7 @@ struct cmd_q *cmdq_new(struct client *);
|
|||||||
int cmdq_free(struct cmd_q *);
|
int cmdq_free(struct cmd_q *);
|
||||||
void printflike(2, 3) cmdq_print(struct cmd_q *, const char *, ...);
|
void printflike(2, 3) cmdq_print(struct cmd_q *, const char *, ...);
|
||||||
void printflike(2, 3) cmdq_error(struct cmd_q *, const char *, ...);
|
void printflike(2, 3) cmdq_error(struct cmd_q *, const char *, ...);
|
||||||
int cmdq_guard(struct cmd_q *, const char *, int);
|
void cmdq_guard(struct cmd_q *, const char *, int);
|
||||||
void cmdq_run(struct cmd_q *, struct cmd_list *);
|
void cmdq_run(struct cmd_q *, struct cmd_list *);
|
||||||
void cmdq_append(struct cmd_q *, struct cmd_list *);
|
void cmdq_append(struct cmd_q *, struct cmd_list *);
|
||||||
int cmdq_continue(struct cmd_q *);
|
int cmdq_continue(struct cmd_q *);
|
||||||
|
Loading…
Reference in New Issue
Block a user