diff options
author | nicm <nicm> | 2015-02-05 10:26:29 +0000 |
---|---|---|
committer | nicm <nicm> | 2015-02-05 10:26:29 +0000 |
commit | e5d9ceff18e37320b9243d24204a0a79d77172e4 (patch) | |
tree | def053355296b4c0e6a156c25f3e4160e6698617 /cmd-queue.c | |
parent | c9642ee21367f0bf2b17b423d7155c88138aa9fc (diff) | |
download | rtmux-e5d9ceff18e37320b9243d24204a0a79d77172e4.tar.gz rtmux-e5d9ceff18e37320b9243d24204a0a79d77172e4.tar.bz2 rtmux-e5d9ceff18e37320b9243d24204a0a79d77172e4.zip |
There is no need to save the guard state because the function checks it
again anyway.
Diffstat (limited to 'cmd-queue.c')
-rw-r--r-- | cmd-queue.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/cmd-queue.c b/cmd-queue.c index a98fa9b6..58282c8f 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -117,20 +117,17 @@ cmdq_error(struct cmd_q *cmdq, const char *fmt, ...) } /* Print a guard line. */ -int +void cmdq_guard(struct cmd_q *cmdq, const char *guard, int flags) { struct client *c = cmdq->client; - if (c == NULL) - return (0); - if (!(c->flags & CLIENT_CONTROL)) - return (0); + if (c == NULL || !(c->flags & CLIENT_CONTROL)) + return; evbuffer_add_printf(c->stdout_data, "%%%s %ld %u %d\n", guard, (long) cmdq->time, cmdq->number, flags); server_push_stdout(c); - return (1); } /* 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; enum cmd_retval retval; - int empty, guard, flags; + int empty, flags; char s[1024]; notify_disable(); @@ -188,16 +185,14 @@ cmdq_continue(struct cmd_q *cmdq) cmdq->number++; 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); - if (guard) { - if (retval == CMD_RETURN_ERROR) - cmdq_guard(cmdq, "error", flags); - else - cmdq_guard(cmdq, "end", flags); - } + if (retval == CMD_RETURN_ERROR) + cmdq_guard(cmdq, "error", flags); + else + cmdq_guard(cmdq, "end", flags); if (retval == CMD_RETURN_ERROR) break; |