From 1b31d148c94f48932f439baa4d336e7de1035ddf Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 3 Oct 2016 22:52:11 +0000 Subject: [PATCH] Remove some dead code in cmd-move-window.c and make a load of local functions static. --- alerts.c | 42 ++++---- client.c | 60 +++++------ cmd-move-window.c | 3 - input-keys.c | 6 +- input.c | 257 +++++++++++++++++++++++----------------------- options-table.c | 14 +-- tty-acs.c | 6 +- window-copy.c | 4 +- xterm-keys.c | 13 +-- 9 files changed, 202 insertions(+), 203 deletions(-) diff --git a/alerts.c b/alerts.c index 36678351..bcca8f3d 100644 --- a/alerts.c +++ b/alerts.c @@ -22,21 +22,21 @@ #include "tmux.h" -int alerts_fired; +static int alerts_fired; -void alerts_timer(int, short, void *); -int alerts_enabled(struct window *, int); -void alerts_callback(int, short, void *); -void alerts_reset(struct window *); +static void alerts_timer(int, short, void *); +static int alerts_enabled(struct window *, int); +static void alerts_callback(int, short, void *); +static void alerts_reset(struct window *); -void alerts_run_hook(struct session *, struct winlink *, int); -int alerts_check_all(struct session *, struct winlink *); -int alerts_check_bell(struct session *, struct winlink *); -int alerts_check_activity(struct session *, struct winlink *); -int alerts_check_silence(struct session *, struct winlink *); -void alerts_ring_bell(struct session *); +static void alerts_run_hook(struct session *, struct winlink *, int); +static int alerts_check_all(struct session *, struct winlink *); +static int alerts_check_bell(struct session *, struct winlink *); +static int alerts_check_activity(struct session *, struct winlink *); +static int alerts_check_silence(struct session *, struct winlink *); +static void alerts_ring_bell(struct session *); -void +static void alerts_timer(__unused int fd, __unused short events, void *arg) { struct window *w = arg; @@ -46,7 +46,7 @@ alerts_timer(__unused int fd, __unused short events, void *arg) alerts_queue(w, WINDOW_SILENCE); } -void +static void alerts_callback(__unused int fd, __unused short events, __unused void *arg) { struct window *w; @@ -72,7 +72,7 @@ alerts_callback(__unused int fd, __unused short events, __unused void *arg) alerts_fired = 0; } -void +static void alerts_run_hook(struct session *s, struct winlink *wl, int flags) { struct cmd_find_state fs; @@ -88,7 +88,7 @@ alerts_run_hook(struct session *s, struct winlink *wl, int flags) hooks_run(s->hooks, NULL, &fs, "alert-activity"); } -int +static int alerts_check_all(struct session *s, struct winlink *wl) { int alerts; @@ -113,7 +113,7 @@ alerts_check_session(struct session *s) alerts_check_all(s, wl); } -int +static int alerts_enabled(struct window *w, int flags) { if (flags & WINDOW_BELL) @@ -138,7 +138,7 @@ alerts_reset_all(void) alerts_reset(w); } -void +static void alerts_reset(struct window *w) { struct timeval tv; @@ -175,7 +175,7 @@ alerts_queue(struct window *w, int flags) } } -int +static int alerts_check_bell(struct session *s, struct winlink *wl) { struct client *c; @@ -218,7 +218,7 @@ alerts_check_bell(struct session *s, struct winlink *wl) return (WINDOW_BELL); } -int +static int alerts_check_activity(struct session *s, struct winlink *wl) { struct client *c; @@ -250,7 +250,7 @@ alerts_check_activity(struct session *s, struct winlink *wl) return (WINDOW_ACTIVITY); } -int +static int alerts_check_silence(struct session *s, struct winlink *wl) { struct client *c; @@ -282,7 +282,7 @@ alerts_check_silence(struct session *s, struct winlink *wl) return (WINDOW_SILENCE); } -void +static void alerts_ring_bell(struct session *s) { struct client *c; diff --git a/client.c b/client.c index ed15bc80..4d00f39b 100644 --- a/client.c +++ b/client.c @@ -34,11 +34,11 @@ #include "tmux.h" -struct tmuxproc *client_proc; -struct tmuxpeer *client_peer; -int client_flags; -struct event client_stdin; -enum { +static struct tmuxproc *client_proc; +static struct tmuxpeer *client_peer; +static int client_flags; +static struct event client_stdin; +static enum { CLIENT_EXIT_NONE, CLIENT_EXIT_DETACHED, CLIENT_EXIT_DETACHED_HUP, @@ -48,29 +48,29 @@ enum { CLIENT_EXIT_EXITED, CLIENT_EXIT_SERVER_EXITED, } client_exitreason = CLIENT_EXIT_NONE; -int client_exitval; -enum msgtype client_exittype; -const char *client_exitsession; -int client_attached; +static int client_exitval; +static enum msgtype client_exittype; +static const char *client_exitsession; +static int client_attached; -__dead void client_exec(const char *,const char *); -int client_get_lock(char *); -int client_connect(struct event_base *, const char *, int); -void client_send_identify(const char *, const char *); -void client_stdin_callback(int, short, void *); -void client_write(int, const char *, size_t); -void client_signal(int); -void client_dispatch(struct imsg *, void *); -void client_dispatch_attached(struct imsg *); -void client_dispatch_wait(struct imsg *, const char *); -const char *client_exit_message(void); +static __dead void client_exec(const char *,const char *); +static int client_get_lock(char *); +static int client_connect(struct event_base *, const char *, int); +static void client_send_identify(const char *, const char *); +static void client_stdin_callback(int, short, void *); +static void client_write(int, const char *, size_t); +static void client_signal(int); +static void client_dispatch(struct imsg *, void *); +static void client_dispatch_attached(struct imsg *); +static void client_dispatch_wait(struct imsg *, const char *); +static const char *client_exit_message(void); /* * Get server create lock. If already held then server start is happening in * another client, so block until the lock is released and return -2 to * retry. Return -1 on failure to continue and start the server anyway. */ -int +static int client_get_lock(char *lockfile) { int lockfd; @@ -97,7 +97,7 @@ client_get_lock(char *lockfile) } /* Connect client to server. */ -int +static int client_connect(struct event_base *base, const char *path, int start_server) { struct sockaddr_un sa; @@ -380,7 +380,7 @@ client_main(struct event_base *base, int argc, char **argv, int flags, } /* Send identify messages to server. */ -void +static void client_send_identify(const char *ttynam, const char *cwd) { const char *s; @@ -417,7 +417,7 @@ client_send_identify(const char *ttynam, const char *cwd) } /* Callback for client stdin read events. */ -void +static void client_stdin_callback(__unused int fd, __unused short events, __unused void *arg) { @@ -433,7 +433,7 @@ client_stdin_callback(__unused int fd, __unused short events, } /* Force write to file descriptor. */ -void +static void client_write(int fd, const char *data, size_t size) { ssize_t used; @@ -451,7 +451,7 @@ client_write(int fd, const char *data, size_t size) } /* Run command in shell; used for -c. */ -__dead void +static __dead void client_exec(const char *shell, const char *shellcmd) { const char *name, *ptr; @@ -480,7 +480,7 @@ client_exec(const char *shell, const char *shellcmd) } /* Callback to handle signals in the client. */ -void +static void client_signal(int sig) { struct sigaction sigact; @@ -520,7 +520,7 @@ client_signal(int sig) } /* Callback for client read events. */ -void +static void client_dispatch(struct imsg *imsg, void *arg) { if (imsg == NULL) { @@ -537,7 +537,7 @@ client_dispatch(struct imsg *imsg, void *arg) } /* Dispatch imsgs when in wait state (before MSG_READY). */ -void +static void client_dispatch_wait(struct imsg *imsg, const char *shellcmd) { char *data; @@ -631,7 +631,7 @@ client_dispatch_wait(struct imsg *imsg, const char *shellcmd) } /* Dispatch imsgs in attached state (after MSG_READY). */ -void +static void client_dispatch_attached(struct imsg *imsg) { struct sigaction sigact; diff --git a/cmd-move-window.c b/cmd-move-window.c index e756a638..aa683b83 100644 --- a/cmd-move-window.c +++ b/cmd-move-window.c @@ -66,9 +66,6 @@ cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq) char *cause; int idx = cmdq->state.tflag.idx, kflag, dflag, sflag; - kflag = args_has(self->args, 'k'); - dflag = args_has(self->args, 'd'); - if (args_has(args, 'r')) { session_renumber_windows(dst); recalculate_sizes(); diff --git a/input-keys.c b/input-keys.c index 41bd5ab5..767c5ca9 100644 --- a/input-keys.c +++ b/input-keys.c @@ -31,7 +31,7 @@ * direction with output). */ -void input_key_mouse(struct window_pane *, struct mouse_event *); +static void input_key_mouse(struct window_pane *, struct mouse_event *); struct input_key_ent { key_code key; @@ -42,7 +42,7 @@ struct input_key_ent { #define INPUTKEY_CURSOR 0x2 /* cursor key */ }; -const struct input_key_ent input_keys[] = { +static const struct input_key_ent input_keys[] = { /* Backspace key. */ { KEYC_BSPACE, "\177", 0 }, @@ -232,7 +232,7 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m) } /* Translate mouse and output. */ -void +static void input_key_mouse(struct window_pane *wp, struct mouse_event *m) { char buf[40]; diff --git a/input.c b/input.c index 5c11a61d..c3bd6510 100644 --- a/input.c +++ b/input.c @@ -98,45 +98,46 @@ struct input_ctx { /* Helper functions. */ struct input_transition; -int input_split(struct input_ctx *); -int input_get(struct input_ctx *, u_int, int, int); -void printflike(2, 3) input_reply(struct input_ctx *, const char *, ...); -void input_set_state(struct window_pane *, const struct input_transition *); -void input_reset_cell(struct input_ctx *); +static int input_split(struct input_ctx *); +static int input_get(struct input_ctx *, u_int, int, int); +static void printflike(2, 3) input_reply(struct input_ctx *, const char *, ...); +static void input_set_state(struct window_pane *, + const struct input_transition *); +static void input_reset_cell(struct input_ctx *); /* Transition entry/exit handlers. */ -void input_clear(struct input_ctx *); -void input_ground(struct input_ctx *); -void input_enter_osc(struct input_ctx *); -void input_exit_osc(struct input_ctx *); -void input_enter_apc(struct input_ctx *); -void input_exit_apc(struct input_ctx *); -void input_enter_rename(struct input_ctx *); -void input_exit_rename(struct input_ctx *); +static void input_clear(struct input_ctx *); +static void input_ground(struct input_ctx *); +static void input_enter_osc(struct input_ctx *); +static void input_exit_osc(struct input_ctx *); +static void input_enter_apc(struct input_ctx *); +static void input_exit_apc(struct input_ctx *); +static void input_enter_rename(struct input_ctx *); +static void input_exit_rename(struct input_ctx *); /* Input state handlers. */ -int input_print(struct input_ctx *); -int input_intermediate(struct input_ctx *); -int input_parameter(struct input_ctx *); -int input_input(struct input_ctx *); -int input_c0_dispatch(struct input_ctx *); -int input_esc_dispatch(struct input_ctx *); -int input_csi_dispatch(struct input_ctx *); -void input_csi_dispatch_rm(struct input_ctx *); -void input_csi_dispatch_rm_private(struct input_ctx *); -void input_csi_dispatch_sm(struct input_ctx *); -void input_csi_dispatch_sm_private(struct input_ctx *); -void input_csi_dispatch_winops(struct input_ctx *); -void input_csi_dispatch_sgr_256(struct input_ctx *, int, u_int *); -void input_csi_dispatch_sgr_rgb(struct input_ctx *, int, u_int *); -void input_csi_dispatch_sgr(struct input_ctx *); -int input_dcs_dispatch(struct input_ctx *); -int input_utf8_open(struct input_ctx *); -int input_utf8_add(struct input_ctx *); -int input_utf8_close(struct input_ctx *); +static int input_print(struct input_ctx *); +static int input_intermediate(struct input_ctx *); +static int input_parameter(struct input_ctx *); +static int input_input(struct input_ctx *); +static int input_c0_dispatch(struct input_ctx *); +static int input_esc_dispatch(struct input_ctx *); +static int input_csi_dispatch(struct input_ctx *); +static void input_csi_dispatch_rm(struct input_ctx *); +static void input_csi_dispatch_rm_private(struct input_ctx *); +static void input_csi_dispatch_sm(struct input_ctx *); +static void input_csi_dispatch_sm_private(struct input_ctx *); +static void input_csi_dispatch_winops(struct input_ctx *); +static void input_csi_dispatch_sgr_256(struct input_ctx *, int, u_int *); +static void input_csi_dispatch_sgr_rgb(struct input_ctx *, int, u_int *); +static void input_csi_dispatch_sgr(struct input_ctx *); +static int input_dcs_dispatch(struct input_ctx *); +static int input_utf8_open(struct input_ctx *); +static int input_utf8_add(struct input_ctx *); +static int input_utf8_close(struct input_ctx *); /* Command table comparison function. */ -int input_table_compare(const void *, const void *); +static int input_table_compare(const void *, const void *); /* Command table entry. */ struct input_table_entry { @@ -164,7 +165,7 @@ enum input_esc_type { }; /* Escape command table. */ -const struct input_table_entry input_esc_table[] = { +static const struct input_table_entry input_esc_table[] = { { '0', "(", INPUT_ESC_SCSG0_ON }, { '0', ")", INPUT_ESC_SCSG1_ON }, { '7', "", INPUT_ESC_DECSC }, @@ -217,7 +218,7 @@ enum input_csi_type { }; /* Control (CSI) command table. */ -const struct input_table_entry input_csi_table[] = { +static const struct input_table_entry input_csi_table[] = { { '@', "", INPUT_CSI_ICH }, { 'A', "", INPUT_CSI_CUU }, { 'B', "", INPUT_CSI_CUD }, @@ -276,169 +277,169 @@ struct input_state { { 0x1b, 0x1b, NULL, &input_state_esc_enter } /* Forward declarations of state tables. */ -const struct input_transition input_state_ground_table[]; -const struct input_transition input_state_esc_enter_table[]; -const struct input_transition input_state_esc_intermediate_table[]; -const struct input_transition input_state_csi_enter_table[]; -const struct input_transition input_state_csi_parameter_table[]; -const struct input_transition input_state_csi_intermediate_table[]; -const struct input_transition input_state_csi_ignore_table[]; -const struct input_transition input_state_dcs_enter_table[]; -const struct input_transition input_state_dcs_parameter_table[]; -const struct input_transition input_state_dcs_intermediate_table[]; -const struct input_transition input_state_dcs_handler_table[]; -const struct input_transition input_state_dcs_escape_table[]; -const struct input_transition input_state_dcs_ignore_table[]; -const struct input_transition input_state_osc_string_table[]; -const struct input_transition input_state_apc_string_table[]; -const struct input_transition input_state_rename_string_table[]; -const struct input_transition input_state_consume_st_table[]; -const struct input_transition input_state_utf8_three_table[]; -const struct input_transition input_state_utf8_two_table[]; -const struct input_transition input_state_utf8_one_table[]; +static const struct input_transition input_state_ground_table[]; +static const struct input_transition input_state_esc_enter_table[]; +static const struct input_transition input_state_esc_intermediate_table[]; +static const struct input_transition input_state_csi_enter_table[]; +static const struct input_transition input_state_csi_parameter_table[]; +static const struct input_transition input_state_csi_intermediate_table[]; +static const struct input_transition input_state_csi_ignore_table[]; +static const struct input_transition input_state_dcs_enter_table[]; +static const struct input_transition input_state_dcs_parameter_table[]; +static const struct input_transition input_state_dcs_intermediate_table[]; +static const struct input_transition input_state_dcs_handler_table[]; +static const struct input_transition input_state_dcs_escape_table[]; +static const struct input_transition input_state_dcs_ignore_table[]; +static const struct input_transition input_state_osc_string_table[]; +static const struct input_transition input_state_apc_string_table[]; +static const struct input_transition input_state_rename_string_table[]; +static const struct input_transition input_state_consume_st_table[]; +static const struct input_transition input_state_utf8_three_table[]; +static const struct input_transition input_state_utf8_two_table[]; +static const struct input_transition input_state_utf8_one_table[]; /* ground state definition. */ -const struct input_state input_state_ground = { +static const struct input_state input_state_ground = { "ground", input_ground, NULL, input_state_ground_table }; /* esc_enter state definition. */ -const struct input_state input_state_esc_enter = { +static const struct input_state input_state_esc_enter = { "esc_enter", input_clear, NULL, input_state_esc_enter_table }; /* esc_intermediate state definition. */ -const struct input_state input_state_esc_intermediate = { +static const struct input_state input_state_esc_intermediate = { "esc_intermediate", NULL, NULL, input_state_esc_intermediate_table }; /* csi_enter state definition. */ -const struct input_state input_state_csi_enter = { +static const struct input_state input_state_csi_enter = { "csi_enter", input_clear, NULL, input_state_csi_enter_table }; /* csi_parameter state definition. */ -const struct input_state input_state_csi_parameter = { +static const struct input_state input_state_csi_parameter = { "csi_parameter", NULL, NULL, input_state_csi_parameter_table }; /* csi_intermediate state definition. */ -const struct input_state input_state_csi_intermediate = { +static const struct input_state input_state_csi_intermediate = { "csi_intermediate", NULL, NULL, input_state_csi_intermediate_table }; /* csi_ignore state definition. */ -const struct input_state input_state_csi_ignore = { +static const struct input_state input_state_csi_ignore = { "csi_ignore", NULL, NULL, input_state_csi_ignore_table }; /* dcs_enter state definition. */ -const struct input_state input_state_dcs_enter = { +static const struct input_state input_state_dcs_enter = { "dcs_enter", input_clear, NULL, input_state_dcs_enter_table }; /* dcs_parameter state definition. */ -const struct input_state input_state_dcs_parameter = { +static const struct input_state input_state_dcs_parameter = { "dcs_parameter", NULL, NULL, input_state_dcs_parameter_table }; /* dcs_intermediate state definition. */ -const struct input_state input_state_dcs_intermediate = { +static const struct input_state input_state_dcs_intermediate = { "dcs_intermediate", NULL, NULL, input_state_dcs_intermediate_table }; /* dcs_handler state definition. */ -const struct input_state input_state_dcs_handler = { +static const struct input_state input_state_dcs_handler = { "dcs_handler", NULL, NULL, input_state_dcs_handler_table }; /* dcs_escape state definition. */ -const struct input_state input_state_dcs_escape = { +static const struct input_state input_state_dcs_escape = { "dcs_escape", NULL, NULL, input_state_dcs_escape_table }; /* dcs_ignore state definition. */ -const struct input_state input_state_dcs_ignore = { +static const struct input_state input_state_dcs_ignore = { "dcs_ignore", NULL, NULL, input_state_dcs_ignore_table }; /* osc_string state definition. */ -const struct input_state input_state_osc_string = { +static const struct input_state input_state_osc_string = { "osc_string", input_enter_osc, input_exit_osc, input_state_osc_string_table }; /* apc_string state definition. */ -const struct input_state input_state_apc_string = { +static const struct input_state input_state_apc_string = { "apc_string", input_enter_apc, input_exit_apc, input_state_apc_string_table }; /* rename_string state definition. */ -const struct input_state input_state_rename_string = { +static const struct input_state input_state_rename_string = { "rename_string", input_enter_rename, input_exit_rename, input_state_rename_string_table }; /* consume_st state definition. */ -const struct input_state input_state_consume_st = { +static const struct input_state input_state_consume_st = { "consume_st", NULL, NULL, input_state_consume_st_table }; /* utf8_three state definition. */ -const struct input_state input_state_utf8_three = { +static const struct input_state input_state_utf8_three = { "utf8_three", NULL, NULL, input_state_utf8_three_table }; /* utf8_two state definition. */ -const struct input_state input_state_utf8_two = { +static const struct input_state input_state_utf8_two = { "utf8_two", NULL, NULL, input_state_utf8_two_table }; /* utf8_one state definition. */ -const struct input_state input_state_utf8_one = { +static const struct input_state input_state_utf8_one = { "utf8_one", NULL, NULL, input_state_utf8_one_table }; /* ground state table. */ -const struct input_transition input_state_ground_table[] = { +static const struct input_transition input_state_ground_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, input_c0_dispatch, NULL }, @@ -456,7 +457,7 @@ const struct input_transition input_state_ground_table[] = { }; /* esc_enter state table. */ -const struct input_transition input_state_esc_enter_table[] = { +static const struct input_transition input_state_esc_enter_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, input_c0_dispatch, NULL }, @@ -483,7 +484,7 @@ const struct input_transition input_state_esc_enter_table[] = { }; /* esc_interm state table. */ -const struct input_transition input_state_esc_intermediate_table[] = { +static const struct input_transition input_state_esc_intermediate_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, input_c0_dispatch, NULL }, @@ -497,7 +498,7 @@ const struct input_transition input_state_esc_intermediate_table[] = { }; /* csi_enter state table. */ -const struct input_transition input_state_csi_enter_table[] = { +static const struct input_transition input_state_csi_enter_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, input_c0_dispatch, NULL }, @@ -515,7 +516,7 @@ const struct input_transition input_state_csi_enter_table[] = { }; /* csi_parameter state table. */ -const struct input_transition input_state_csi_parameter_table[] = { +static const struct input_transition input_state_csi_parameter_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, input_c0_dispatch, NULL }, @@ -533,7 +534,7 @@ const struct input_transition input_state_csi_parameter_table[] = { }; /* csi_intermediate state table. */ -const struct input_transition input_state_csi_intermediate_table[] = { +static const struct input_transition input_state_csi_intermediate_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, input_c0_dispatch, NULL }, @@ -548,7 +549,7 @@ const struct input_transition input_state_csi_intermediate_table[] = { }; /* csi_ignore state table. */ -const struct input_transition input_state_csi_ignore_table[] = { +static const struct input_transition input_state_csi_ignore_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, input_c0_dispatch, NULL }, @@ -562,7 +563,7 @@ const struct input_transition input_state_csi_ignore_table[] = { }; /* dcs_enter state table. */ -const struct input_transition input_state_dcs_enter_table[] = { +static const struct input_transition input_state_dcs_enter_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, NULL, NULL }, @@ -580,7 +581,7 @@ const struct input_transition input_state_dcs_enter_table[] = { }; /* dcs_parameter state table. */ -const struct input_transition input_state_dcs_parameter_table[] = { +static const struct input_transition input_state_dcs_parameter_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, NULL, NULL }, @@ -598,7 +599,7 @@ const struct input_transition input_state_dcs_parameter_table[] = { }; /* dcs_interm state table. */ -const struct input_transition input_state_dcs_intermediate_table[] = { +static const struct input_transition input_state_dcs_intermediate_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, NULL, NULL }, @@ -613,7 +614,7 @@ const struct input_transition input_state_dcs_intermediate_table[] = { }; /* dcs_handler state table. */ -const struct input_transition input_state_dcs_handler_table[] = { +static const struct input_transition input_state_dcs_handler_table[] = { /* No INPUT_STATE_ANYWHERE */ { 0x00, 0x1a, input_input, NULL }, @@ -624,7 +625,7 @@ const struct input_transition input_state_dcs_handler_table[] = { }; /* dcs_escape state table. */ -const struct input_transition input_state_dcs_escape_table[] = { +static const struct input_transition input_state_dcs_escape_table[] = { /* No INPUT_STATE_ANYWHERE */ { 0x00, 0x5b, input_input, &input_state_dcs_handler }, @@ -635,7 +636,7 @@ const struct input_transition input_state_dcs_escape_table[] = { }; /* dcs_ignore state table. */ -const struct input_transition input_state_dcs_ignore_table[] = { +static const struct input_transition input_state_dcs_ignore_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, NULL, NULL }, @@ -647,7 +648,7 @@ const struct input_transition input_state_dcs_ignore_table[] = { }; /* osc_string state table. */ -const struct input_transition input_state_osc_string_table[] = { +static const struct input_transition input_state_osc_string_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x06, NULL, NULL }, @@ -661,7 +662,7 @@ const struct input_transition input_state_osc_string_table[] = { }; /* apc_string state table. */ -const struct input_transition input_state_apc_string_table[] = { +static const struct input_transition input_state_apc_string_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, NULL, NULL }, @@ -673,7 +674,7 @@ const struct input_transition input_state_apc_string_table[] = { }; /* rename_string state table. */ -const struct input_transition input_state_rename_string_table[] = { +static const struct input_transition input_state_rename_string_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, NULL, NULL }, @@ -685,7 +686,7 @@ const struct input_transition input_state_rename_string_table[] = { }; /* consume_st state table. */ -const struct input_transition input_state_consume_st_table[] = { +static const struct input_transition input_state_consume_st_table[] = { INPUT_STATE_ANYWHERE, { 0x00, 0x17, NULL, NULL }, @@ -697,7 +698,7 @@ const struct input_transition input_state_consume_st_table[] = { }; /* utf8_three state table. */ -const struct input_transition input_state_utf8_three_table[] = { +static const struct input_transition input_state_utf8_three_table[] = { /* No INPUT_STATE_ANYWHERE */ { 0x00, 0x7f, NULL, &input_state_ground }, @@ -708,7 +709,7 @@ const struct input_transition input_state_utf8_three_table[] = { }; /* utf8_two state table. */ -const struct input_transition input_state_utf8_two_table[] = { +static const struct input_transition input_state_utf8_two_table[] = { /* No INPUT_STATE_ANYWHERE */ { 0x00, 0x7f, NULL, &input_state_ground }, @@ -719,7 +720,7 @@ const struct input_transition input_state_utf8_two_table[] = { }; /* utf8_one state table. */ -const struct input_transition input_state_utf8_one_table[] = { +static const struct input_transition input_state_utf8_one_table[] = { /* No INPUT_STATE_ANYWHERE */ { 0x00, 0x7f, NULL, &input_state_ground }, @@ -730,7 +731,7 @@ const struct input_transition input_state_utf8_one_table[] = { }; /* Input table compare. */ -int +static int input_table_compare(const void *key, const void *value) { const struct input_ctx *ictx = key; @@ -742,7 +743,7 @@ input_table_compare(const void *key, const void *value) } /* Reset cell state to default. */ -void +static void input_reset_cell(struct input_ctx *ictx) { memcpy(&ictx->cell.cell, &grid_default_cell, sizeof ictx->cell.cell); @@ -821,7 +822,7 @@ input_pending(struct window_pane *wp) } /* Change input state. */ -void +static void input_set_state(struct window_pane *wp, const struct input_transition *itr) { struct input_ctx *ictx = wp->ictx; @@ -906,7 +907,7 @@ input_parse(struct window_pane *wp) } /* Split the parameter list (if any). */ -int +static int input_split(struct input_ctx *ictx) { @@ -937,7 +938,7 @@ input_split(struct input_ctx *ictx) } /* Get an argument or return default value. */ -int +static int input_get(struct input_ctx *ictx, u_int validx, int minval, int defval) { int retval; @@ -954,7 +955,7 @@ input_get(struct input_ctx *ictx, u_int validx, int minval, int defval) } /* Reply to terminal query. */ -void +static void input_reply(struct input_ctx *ictx, const char *fmt, ...) { va_list ap; @@ -969,7 +970,7 @@ input_reply(struct input_ctx *ictx, const char *fmt, ...) } /* Clear saved state. */ -void +static void input_clear(struct input_ctx *ictx) { *ictx->interm_buf = '\0'; @@ -985,7 +986,7 @@ input_clear(struct input_ctx *ictx) } /* Reset for ground state. */ -void +static void input_ground(struct input_ctx *ictx) { evbuffer_drain(ictx->since_ground, EVBUFFER_LENGTH(ictx->since_ground)); @@ -997,7 +998,7 @@ input_ground(struct input_ctx *ictx) } /* Output this character to the screen. */ -int +static int input_print(struct input_ctx *ictx) { int set; @@ -1017,7 +1018,7 @@ input_print(struct input_ctx *ictx) } /* Collect intermediate string. */ -int +static int input_intermediate(struct input_ctx *ictx) { if (ictx->interm_len == (sizeof ictx->interm_buf) - 1) @@ -1031,7 +1032,7 @@ input_intermediate(struct input_ctx *ictx) } /* Collect parameter string. */ -int +static int input_parameter(struct input_ctx *ictx) { if (ictx->param_len == (sizeof ictx->param_buf) - 1) @@ -1045,7 +1046,7 @@ input_parameter(struct input_ctx *ictx) } /* Collect input string. */ -int +static int input_input(struct input_ctx *ictx) { size_t available; @@ -1067,7 +1068,7 @@ input_input(struct input_ctx *ictx) } /* Execute C0 control sequence. */ -int +static int input_c0_dispatch(struct input_ctx *ictx) { struct screen_write_ctx *sctx = &ictx->ctx; @@ -1120,7 +1121,7 @@ input_c0_dispatch(struct input_ctx *ictx) } /* Execute escape sequence. */ -int +static int input_esc_dispatch(struct input_ctx *ictx) { struct screen_write_ctx *sctx = &ictx->ctx; @@ -1193,7 +1194,7 @@ input_esc_dispatch(struct input_ctx *ictx) } /* Execute control sequence. */ -int +static int input_csi_dispatch(struct input_ctx *ictx) { struct screen_write_ctx *sctx = &ictx->ctx; @@ -1410,7 +1411,7 @@ input_csi_dispatch(struct input_ctx *ictx) } /* Handle CSI RM. */ -void +static void input_csi_dispatch_rm(struct input_ctx *ictx) { u_int i; @@ -1431,7 +1432,7 @@ input_csi_dispatch_rm(struct input_ctx *ictx) } /* Handle CSI private RM. */ -void +static void input_csi_dispatch_rm_private(struct input_ctx *ictx) { struct window_pane *wp = ictx->wp; @@ -1487,7 +1488,7 @@ input_csi_dispatch_rm_private(struct input_ctx *ictx) } /* Handle CSI SM. */ -void +static void input_csi_dispatch_sm(struct input_ctx *ictx) { u_int i; @@ -1508,7 +1509,7 @@ input_csi_dispatch_sm(struct input_ctx *ictx) } /* Handle CSI private SM. */ -void +static void input_csi_dispatch_sm_private(struct input_ctx *ictx) { struct window_pane *wp = ictx->wp; @@ -1570,7 +1571,7 @@ input_csi_dispatch_sm_private(struct input_ctx *ictx) } /* Handle CSI window operations. */ -void +static void input_csi_dispatch_winops(struct input_ctx *ictx) { struct window_pane *wp = ictx->wp; @@ -1619,7 +1620,7 @@ input_csi_dispatch_winops(struct input_ctx *ictx) } /* Handle CSI SGR for 256 colours. */ -void +static void input_csi_dispatch_sgr_256(struct input_ctx *ictx, int fgbg, u_int *i) { struct grid_cell *gc = &ictx->cell.cell; @@ -1641,7 +1642,7 @@ input_csi_dispatch_sgr_256(struct input_ctx *ictx, int fgbg, u_int *i) } /* Handle CSI SGR for RGB colours. */ -void +static void input_csi_dispatch_sgr_rgb(struct input_ctx *ictx, int fgbg, u_int *i) { struct grid_cell *gc = &ictx->cell.cell; @@ -1667,7 +1668,7 @@ input_csi_dispatch_sgr_rgb(struct input_ctx *ictx, int fgbg, u_int *i) } /* Handle CSI SGR. */ -void +static void input_csi_dispatch_sgr(struct input_ctx *ictx) { struct grid_cell *gc = &ictx->cell.cell; @@ -1787,7 +1788,7 @@ input_csi_dispatch_sgr(struct input_ctx *ictx) } /* DCS terminator (ST) received. */ -int +static int input_dcs_dispatch(struct input_ctx *ictx) { const char prefix[] = "tmux;"; @@ -1809,7 +1810,7 @@ input_dcs_dispatch(struct input_ctx *ictx) } /* OSC string started. */ -void +static void input_enter_osc(struct input_ctx *ictx) { log_debug("%s", __func__); @@ -1818,7 +1819,7 @@ input_enter_osc(struct input_ctx *ictx) } /* OSC terminator (ST) received. */ -void +static void input_exit_osc(struct input_ctx *ictx) { u_char *p = ictx->input_buf; @@ -1858,7 +1859,7 @@ input_exit_osc(struct input_ctx *ictx) } /* APC string started. */ -void +static void input_enter_apc(struct input_ctx *ictx) { log_debug("%s", __func__); @@ -1867,7 +1868,7 @@ input_enter_apc(struct input_ctx *ictx) } /* APC terminator (ST) received. */ -void +static void input_exit_apc(struct input_ctx *ictx) { if (ictx->flags & INPUT_DISCARD) @@ -1879,7 +1880,7 @@ input_exit_apc(struct input_ctx *ictx) } /* Rename string started. */ -void +static void input_enter_rename(struct input_ctx *ictx) { log_debug("%s", __func__); @@ -1888,7 +1889,7 @@ input_enter_rename(struct input_ctx *ictx) } /* Rename terminator (ST) received. */ -void +static void input_exit_rename(struct input_ctx *ictx) { if (ictx->flags & INPUT_DISCARD) @@ -1904,7 +1905,7 @@ input_exit_rename(struct input_ctx *ictx) } /* Open UTF-8 character. */ -int +static int input_utf8_open(struct input_ctx *ictx) { struct utf8_data *ud = &ictx->utf8data; @@ -1918,7 +1919,7 @@ input_utf8_open(struct input_ctx *ictx) } /* Append to UTF-8 character. */ -int +static int input_utf8_add(struct input_ctx *ictx) { struct utf8_data *ud = &ictx->utf8data; @@ -1932,7 +1933,7 @@ input_utf8_add(struct input_ctx *ictx) } /* Close UTF-8 string. */ -int +static int input_utf8_close(struct input_ctx *ictx) { struct utf8_data *ud = &ictx->utf8data; diff --git a/options-table.c b/options-table.c index b96d91b3..67151d6d 100644 --- a/options-table.c +++ b/options-table.c @@ -33,25 +33,25 @@ */ /* Choice option type lists. */ -const char *options_table_mode_keys_list[] = { +static const char *options_table_mode_keys_list[] = { "emacs", "vi", NULL }; -const char *options_table_clock_mode_style_list[] = { +static const char *options_table_clock_mode_style_list[] = { "12", "24", NULL }; -const char *options_table_status_keys_list[] = { +static const char *options_table_status_keys_list[] = { "emacs", "vi", NULL }; -const char *options_table_status_justify_list[] = { +static const char *options_table_status_justify_list[] = { "left", "centre", "right", NULL }; -const char *options_table_status_position_list[] = { +static const char *options_table_status_position_list[] = { "top", "bottom", NULL }; -const char *options_table_bell_action_list[] = { +static const char *options_table_bell_action_list[] = { "none", "any", "current", "other", NULL }; -const char *options_table_pane_status_list[] = { +static const char *options_table_pane_status_list[] = { "off", "top", "bottom", NULL }; diff --git a/tty-acs.c b/tty-acs.c index 7fd265d4..6e3103d9 100644 --- a/tty-acs.c +++ b/tty-acs.c @@ -22,14 +22,14 @@ #include "tmux.h" -int tty_acs_cmp(const void *, const void *); +static int tty_acs_cmp(const void *, const void *); /* Table mapping ACS entries to UTF-8. */ struct tty_acs_entry { u_char key; const char *string; }; -const struct tty_acs_entry tty_acs_table[] = { +static const struct tty_acs_entry tty_acs_table[] = { { '+', "\342\206\222" }, /* arrow pointing right */ { ',', "\342\206\220" }, /* arrow pointing left */ { '-', "\342\206\221" }, /* arrow pointing up */ @@ -64,7 +64,7 @@ const struct tty_acs_entry tty_acs_table[] = { { '~', "\302\267" } /* bullet */ }; -int +static int tty_acs_cmp(const void *key, const void *value) { const struct tty_acs_entry *entry = value; diff --git a/window-copy.c b/window-copy.c index 320cc3d4..4c95ba66 100644 --- a/window-copy.c +++ b/window-copy.c @@ -948,13 +948,13 @@ window_copy_key_input(struct window_pane *wp, key_code key) data->searchtype = data->inputtype; data->searchstr = xstrdup(data->inputstr); for (; np != 0; np--) - window_copy_search_up(wp, data->inputstr, 0); + window_copy_search_up(wp, data->inputstr, 1); break; case WINDOW_COPY_SEARCHDOWN: data->searchtype = data->inputtype; data->searchstr = xstrdup(data->inputstr); for (; np != 0; np--) - window_copy_search_down(wp, data->inputstr, 0); + window_copy_search_down(wp, data->inputstr, 1); break; case WINDOW_COPY_NAMEDBUFFER: window_copy_copy_selection(wp, data->inputstr); diff --git a/xterm-keys.c b/xterm-keys.c index 7bfefd15..5ffc845f 100644 --- a/xterm-keys.c +++ b/xterm-keys.c @@ -40,16 +40,17 @@ * We accept any but always output the latter (it comes first in the table). */ -int xterm_keys_match(const char *, const char *, size_t, size_t *, - key_code *); -int xterm_keys_modifiers(const char *, size_t, size_t *, key_code *); +static int xterm_keys_match(const char *, const char *, size_t, size_t *, + key_code *); +static int xterm_keys_modifiers(const char *, size_t, size_t *, + key_code *); struct xterm_keys_entry { key_code key; const char *template; }; -const struct xterm_keys_entry xterm_keys_table[] = { +static const struct xterm_keys_entry xterm_keys_table[] = { { KEYC_F1, "\033[1;_P" }, { KEYC_F1, "\033O1;_P" }, { KEYC_F1, "\033O_P" }, @@ -114,7 +115,7 @@ const struct xterm_keys_entry xterm_keys_table[] = { * Match key against buffer, treating _ as a wildcard. Return -1 for no match, * 0 for match, 1 if the end of the buffer is reached (need more data). */ -int +static int xterm_keys_match(const char *template, const char *buf, size_t len, size_t *size, key_code *modifiers) { @@ -148,7 +149,7 @@ xterm_keys_match(const char *template, const char *buf, size_t len, } /* Find modifiers from buffer. */ -int +static int xterm_keys_modifiers(const char *buf, size_t len, size_t *pos, key_code *modifiers) {