Skip to content

Commit

Permalink
Rename cmd_q dead flag to a general flags bitmask (will be more flags…
Browse files Browse the repository at this point in the history
… later).
  • Loading branch information
nicm committed Sep 16, 2015
1 parent 16ee4de commit a4b4b29
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd-if-shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ cmd_if_shell_callback(struct job *job)
struct cmd_list *cmdlist;
char *cause, *cmd;

if (cmdq->dead)
if (cmdq->flags & CMD_Q_DEAD)
return;

if (!WIFEXITED(job->status) || WEXITSTATUS(job->status) != 0)
Expand Down
9 changes: 6 additions & 3 deletions cmd-queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cmdq_new(struct client *c)

cmdq = xcalloc(1, sizeof *cmdq);
cmdq->references = 1;
cmdq->dead = 0;
cmdq->flags = 0;

cmdq->client = c;
cmdq->client_exit = -1;
Expand All @@ -51,8 +51,11 @@ cmdq_new(struct client *c)
int
cmdq_free(struct cmd_q *cmdq)
{
if (--cmdq->references != 0)
return (cmdq->dead);
if (--cmdq->references != 0) {
if (cmdq->flags & CMD_Q_DEAD)
return (1);
return (0);
}

cmdq_flush(cmdq);
free(cmdq);
Expand Down
2 changes: 1 addition & 1 deletion cmd-run-shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ cmd_run_shell_callback(struct job *job)
int retcode;
u_int lines;

if (cmdq->dead)
if (cmdq->flags & CMD_Q_DEAD)
return;
cmd = cdata->cmd;

Expand Down
2 changes: 1 addition & 1 deletion server-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ server_client_lost(struct client *c)
free(c->prompt_string);
free(c->prompt_buffer);

c->cmdq->dead = 1;
c->cmdq->flags |= CMD_Q_DEAD;
cmdq_free(c->cmdq);
c->cmdq = NULL;

Expand Down
3 changes: 2 additions & 1 deletion tmux.h
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,8 @@ TAILQ_HEAD(cmd_q_items, cmd_q_item);
/* Command queue. */
struct cmd_q {
int references;
int dead;
int flags;
#define CMD_Q_DEAD 0x1

struct client *client;
int client_exit;
Expand Down

0 comments on commit a4b4b29

Please sign in to comment.