=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-queue.c,v retrieving revision 1.85 retrieving revision 1.86 diff -u -r1.85 -r1.86 --- src/usr.bin/tmux/cmd-queue.c 2020/04/13 13:42:35 1.85 +++ src/usr.bin/tmux/cmd-queue.c 2020/04/13 14:04:25 1.86 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-queue.c,v 1.85 2020/04/13 13:42:35 nicm Exp $ */ +/* $OpenBSD: cmd-queue.c,v 1.86 2020/04/13 14:04:25 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott @@ -51,7 +51,7 @@ int flags; - struct cmdq_shared *shared; + struct cmdq_state *state; struct cmd_find_state source; struct cmd_find_state target; @@ -142,11 +142,11 @@ return (&item->source); } -/* Get item shared. */ -struct cmdq_shared * -cmdq_get_shared(struct cmdq_item *item) +/* Get item state. */ +struct cmdq_state * +cmdq_get_state(struct cmdq_item *item) { - return (item->shared); + return (item->state); } /* Merge formats from item. */ @@ -159,8 +159,8 @@ entry = cmd_get_entry (item->cmd); format_add(ft, "command", "%s", entry->name); } - if (item->shared->formats != NULL) - format_merge(ft, item->shared->formats); + if (item->state->formats != NULL) + format_merge(ft, item->state->formats); } /* Append an item. */ @@ -228,7 +228,7 @@ struct options_array_item *a; struct cmd_list *cmdlist; - if (item->shared->flags & CMDQ_SHARED_NOHOOKS) + if (item->state->flags & CMDQ_STATE_NOHOOKS) return; if (s == NULL) oo = global_s_options; @@ -255,7 +255,7 @@ } new_item = cmdq_get_command(cmdlist, fs, NULL, - CMDQ_SHARED_NOHOOKS); + CMDQ_STATE_NOHOOKS); cmdq_format(new_item, "hook", "%s", name); if (item != NULL) item = cmdq_insert_after(item, new_item); @@ -279,10 +279,10 @@ static void cmdq_remove(struct cmdq_item *item) { - if (item->shared != NULL && --item->shared->references == 0) { - if (item->shared->formats != NULL) - format_free(item->shared->formats); - free(item->shared); + if (item->state != NULL && --item->state->references == 0) { + if (item->state->formats != NULL) + format_free(item->state->formats); + free(item->state); } if (item->client != NULL) @@ -322,23 +322,23 @@ struct cmdq_item *item, *first = NULL, *last = NULL; struct cmd *cmd; const struct cmd_entry *entry; - struct cmdq_shared *shared = NULL; + struct cmdq_state *state = NULL; u_int group, last_group = 0; cmd = cmd_list_first(cmdlist, &group); while (cmd != NULL) { if (group != last_group) { - shared = xcalloc(1, sizeof *shared); + state = xcalloc(1, sizeof *state); if (current != NULL) - cmd_find_copy_state(&shared->current, current); + cmd_find_copy_state(&state->current, current); else - cmd_find_clear_state(&shared->current, 0); + cmd_find_clear_state(&state->current, 0); if (m != NULL) { - shared->event.key = KEYC_NONE; - memcpy(&shared->event.m, m, - sizeof shared->event.m); + state->event.key = KEYC_NONE; + memcpy(&state->event.m, m, + sizeof state->event.m); } - shared->flags = flags; + state->flags = flags; last_group = group; } entry = cmd_get_entry(cmd); @@ -348,13 +348,13 @@ item->type = CMDQ_COMMAND; item->group = group; - item->shared = shared; + item->state = state; item->cmdlist = cmdlist; item->cmd = cmd; log_debug("%s: %s group %u", __func__, item->name, item->group); - shared->references++; + state->references++; cmdlist->references++; if (first == NULL) @@ -394,7 +394,7 @@ { struct client *c = item->client; const char *name = cmdq_name(c); - struct cmdq_shared *shared = item->shared; + struct cmdq_state *state = item->state; struct cmd *cmd = item->cmd; const struct cmd_entry *entry = cmd_get_entry(cmd); enum cmd_retval retval; @@ -408,7 +408,7 @@ free(tmp); } - flags = !!(shared->flags & CMDQ_SHARED_CONTROL); + flags = !!(state->flags & CMDQ_STATE_CONTROL); cmdq_guard(item, "begin", flags); if (item->client == NULL) @@ -427,8 +427,8 @@ if (entry->flags & CMD_AFTERHOOK) { if (cmd_find_valid_state(&item->target)) fsp = &item->target; - else if (cmd_find_valid_state(&item->shared->current)) - fsp = &item->shared->current; + else if (cmd_find_valid_state(&item->state->current)) + fsp = &item->state->current; else if (cmd_find_from_client(&fs, item->client, 0) == 0) fsp = &fs; else @@ -492,7 +492,7 @@ void cmdq_format(struct cmdq_item *item, const char *key, const char *fmt, ...) { - struct cmdq_shared *shared = item->shared; + struct cmdq_state *state = item->state; va_list ap; char *value; @@ -500,9 +500,9 @@ xvasprintf(&value, fmt, ap); va_end(ap); - if (shared->formats == NULL) - shared->formats = format_create(NULL, NULL, FORMAT_NONE, 0); - format_add(shared->formats, key, "%s", value); + if (state->formats == NULL) + state->formats = format_create(NULL, NULL, FORMAT_NONE, 0); + format_add(state->formats, key, "%s", value); free(value); }