diff options
author | nicm <nicm> | 2016-10-10 21:51:39 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-10-10 21:51:39 +0000 |
commit | a81685bfac9d4eac3a7cfd8f8ce13033a46fe01c (patch) | |
tree | f067d0071fc93a06c2364fe419b93cce31ac0825 | |
parent | c426e485e527a03aa3b4bdbb3203f621e006cbd5 (diff) |
Add static in cmd-* and fix a few other nits.
62 files changed, 333 insertions, 339 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c index 53c1df31..daab428f 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -30,7 +30,7 @@ * Attach existing session to the current terminal. */ -enum cmd_retval cmd_attach_session_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_attach_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_attach_session_entry = { .name = "attach-session", @@ -154,7 +154,7 @@ cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag, return (CMD_RETURN_NORMAL); } -enum cmd_retval +static enum cmd_retval cmd_attach_session_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-bind-key.c b/cmd-bind-key.c index 88767245..bcc179c3 100644 --- a/cmd-bind-key.c +++ b/cmd-bind-key.c @@ -27,10 +27,10 @@ * Bind a key to a command, this recurses through cmd_*. */ -enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmd_q *); -enum cmd_retval cmd_bind_key_mode_table(struct cmd *, struct cmd_q *, - key_code); +static enum cmd_retval cmd_bind_key_mode_table(struct cmd *, struct cmd_q *, + key_code); const struct cmd_entry cmd_bind_key_entry = { .name = "bind-key", @@ -44,7 +44,7 @@ const struct cmd_entry cmd_bind_key_entry = { .exec = cmd_bind_key_exec }; -enum cmd_retval +static enum cmd_retval cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -93,7 +93,7 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -enum cmd_retval +static enum cmd_retval cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key) { struct args *args = self->args; diff --git a/cmd-break-pane.c b/cmd-break-pane.c index 85873227..b57542aa 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -28,7 +28,7 @@ #define BREAK_PANE_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}" -enum cmd_retval cmd_break_pane_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_break_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_break_pane_entry = { .name = "break-pane", @@ -44,7 +44,7 @@ const struct cmd_entry cmd_break_pane_entry = { .exec = cmd_break_pane_exec }; -enum cmd_retval +static enum cmd_retval cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c index 33f6cf08..e468674d 100644 --- a/cmd-capture-pane.c +++ b/cmd-capture-pane.c @@ -27,13 +27,14 @@ * Write the entire contents of a pane to a buffer or stdout. */ -enum cmd_retval cmd_capture_pane_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_capture_pane_exec(struct cmd *, struct cmd_q *); -char *cmd_capture_pane_append(char *, size_t *, char *, size_t); -char *cmd_capture_pane_pending(struct args *, struct window_pane *, - size_t *); -char *cmd_capture_pane_history(struct args *, struct cmd_q *, - struct window_pane *, size_t *); +static char *cmd_capture_pane_append(char *, size_t *, char *, + size_t); +static char *cmd_capture_pane_pending(struct args *, + struct window_pane *, size_t *); +static char *cmd_capture_pane_history(struct args *, struct cmd_q *, + struct window_pane *, size_t *); const struct cmd_entry cmd_capture_pane_entry = { .name = "capture-pane", @@ -49,7 +50,7 @@ const struct cmd_entry cmd_capture_pane_entry = { .exec = cmd_capture_pane_exec }; -char * +static char * cmd_capture_pane_append(char *buf, size_t *len, char *line, size_t linelen) { buf = xrealloc(buf, *len + linelen + 1); @@ -58,7 +59,7 @@ cmd_capture_pane_append(char *buf, size_t *len, char *line, size_t linelen) return (buf); } -char * +static char * cmd_capture_pane_pending(struct args *args, struct window_pane *wp, size_t *len) { @@ -90,7 +91,7 @@ cmd_capture_pane_pending(struct args *args, struct window_pane *wp, return (buf); } -char * +static char * cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq, struct window_pane *wp, size_t *len) { @@ -175,7 +176,7 @@ cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq, return (buf); } -enum cmd_retval +static enum cmd_retval cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-choose-buffer.c b/cmd-choose-buffer.c index 90872e90..fee4958a 100644 --- a/cmd-choose-buffer.c +++ b/cmd-choose-buffer.c @@ -30,7 +30,7 @@ #define CHOOSE_BUFFER_TEMPLATE \ "#{buffer_name}: #{buffer_size} bytes: #{buffer_sample}" -enum cmd_retval cmd_choose_buffer_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_choose_buffer_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_choose_buffer_entry = { .name = "choose-buffer", @@ -45,7 +45,7 @@ const struct cmd_entry cmd_choose_buffer_entry = { .exec = cmd_choose_buffer_exec }; -enum cmd_retval +static enum cmd_retval cmd_choose_buffer_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-choose-client.c b/cmd-choose-client.c index b9a24be6..67d184b3 100644 --- a/cmd-choose-client.c +++ b/cmd-choose-client.c @@ -33,9 +33,9 @@ "#{?client_utf8, (utf8),}#{?client_readonly, (ro),} " \ "(last used #{t:client_activity})" -enum cmd_retval cmd_choose_client_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_choose_client_exec(struct cmd *, struct cmd_q *); -void cmd_choose_client_callback(struct window_choose_data *); +static void cmd_choose_client_callback(struct window_choose_data *); const struct cmd_entry cmd_choose_client_entry = { .name = "choose-client", @@ -54,7 +54,7 @@ struct cmd_choose_client_data { struct client *client; }; -enum cmd_retval +static enum cmd_retval cmd_choose_client_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -110,7 +110,7 @@ cmd_choose_client_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -void +static void cmd_choose_client_callback(struct window_choose_data *cdata) { struct client *c; diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c index db9222ba..13bbe2a7 100644 --- a/cmd-choose-tree.c +++ b/cmd-choose-tree.c @@ -41,7 +41,7 @@ "#{window_index}: #{window_name}#{window_flags} " \ "\"#{pane_title}\"" -enum cmd_retval cmd_choose_tree_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_choose_tree_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_choose_tree_entry = { .name = "choose-tree", @@ -83,7 +83,7 @@ const struct cmd_entry cmd_choose_window_entry = { .exec = cmd_choose_tree_exec }; -enum cmd_retval +static enum cmd_retval cmd_choose_tree_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-clear-history.c b/cmd-clear-history.c index 62683ff6..a1da256d 100644 --- a/cmd-clear-history.c +++ b/cmd-clear-history.c @@ -24,7 +24,7 @@ * Clear pane history. */ -enum cmd_retval cmd_clear_history_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_clear_history_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_clear_history_entry = { .name = "clear-history", @@ -39,7 +39,7 @@ const struct cmd_entry cmd_clear_history_entry = { .exec = cmd_clear_history_exec }; -enum cmd_retval +static enum cmd_retval cmd_clear_history_exec(__unused struct cmd *self, struct cmd_q *cmdq) { struct window_pane *wp = cmdq->state.tflag.wp; diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index 3ec22865..a2fc1278 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -29,10 +29,10 @@ * Prompt for command in client. */ -enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *); -int cmd_command_prompt_callback(void *, const char *); -void cmd_command_prompt_free(void *); +static int cmd_command_prompt_callback(void *, const char *); +static void cmd_command_prompt_free(void *); const struct cmd_entry cmd_command_prompt_entry = { .name = "command-prompt", @@ -58,7 +58,7 @@ struct cmd_command_prompt_cdata { int idx; }; -enum cmd_retval +static enum cmd_retval cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -115,7 +115,7 @@ cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -int +static int cmd_command_prompt_callback(void *data, const char *s) { struct cmd_command_prompt_cdata *cdata = data; @@ -162,7 +162,7 @@ cmd_command_prompt_callback(void *data, const char *s) return (0); } -void +static void cmd_command_prompt_free(void *data) { struct cmd_command_prompt_cdata *cdata = data; diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c index b5a12821..4241aefb 100644 --- a/cmd-confirm-before.c +++ b/cmd-confirm-before.c @@ -28,10 +28,10 @@ * Asks for confirmation before executing a command. */ -enum cmd_retval cmd_confirm_before_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_confirm_before_exec(struct cmd *, struct cmd_q *); -int cmd_confirm_before_callback(void *, const char *); -void cmd_confirm_before_free(void *); +static int cmd_confirm_before_callback(void *, const char *); +static void cmd_confirm_before_free(void *); const struct cmd_entry cmd_confirm_before_entry = { .name = "confirm-before", @@ -51,7 +51,7 @@ struct cmd_confirm_before_data { struct client *client; }; -enum cmd_retval +static enum cmd_retval cmd_confirm_before_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -83,7 +83,7 @@ cmd_confirm_before_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -int +static int cmd_confirm_before_callback(void *data, const char *s) { struct cmd_confirm_before_data *cdata = data; @@ -113,7 +113,7 @@ cmd_confirm_before_callback(void *data, const char *s) return (0); } -void +static void cmd_confirm_before_free(void *data) { struct cmd_confirm_before_data *cdata = data; diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c index d785e893..6b99c347 100644 --- a/cmd-copy-mode.c +++ b/cmd-copy-mode.c @@ -24,7 +24,7 @@ * Enter copy or clock mode. */ -enum cmd_retval cmd_copy_mode_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_copy_mode_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_copy_mode_entry = { .name = "copy-mode", @@ -52,7 +52,7 @@ const struct cmd_entry cmd_clock_mode_entry = { .exec = cmd_copy_mode_exec }; -enum cmd_retval +static enum cmd_retval cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-detach-client.c b/cmd-detach-client.c index 80c6555f..814ba091 100644 --- a/cmd-detach-client.c +++ b/cmd-detach-client.c @@ -26,7 +26,7 @@ * Detach a client. */ -enum cmd_retval cmd_detach_client_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_detach_client_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_detach_client_entry = { .name = "detach-client", @@ -55,7 +55,7 @@ const struct cmd_entry cmd_suspend_client_entry = { .exec = cmd_detach_client_exec }; -enum cmd_retval +static enum cmd_retval cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-display-message.c b/cmd-display-message.c index 217d164a..05e84561 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -32,7 +32,7 @@ "#{window_name}, current pane #{pane_index} " \ "- (%H:%M %d-%b-%y)" -enum cmd_retval cmd_display_message_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_display_message_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_display_message_entry = { .name = "display-message", @@ -49,7 +49,7 @@ const struct cmd_entry cmd_display_message_entry = { .exec = cmd_display_message_exec }; -enum cmd_retval +static enum cmd_retval cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-find-window.c b/cmd-find-window.c index 6324f26a..6ab6fbcf 100644 --- a/cmd-find-window.c +++ b/cmd-find-window.c @@ -33,9 +33,9 @@ "[#{window_width}x#{window_height}] " \ "(#{window_panes} panes) #{window_find_matches}" -enum cmd_retval cmd_find_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_find_window_exec(struct cmd *, struct cmd_q *); -void cmd_find_window_callback(struct window_choose_data *); +static void cmd_find_window_callback(struct window_choose_data *); /* Flags for determining matching behavior. */ #define CMD_FIND_WINDOW_BY_TITLE 0x1 @@ -68,11 +68,11 @@ struct cmd_find_window_data { }; TAILQ_HEAD(cmd_find_window_list, cmd_find_window_data); -u_int cmd_find_window_match_flags(struct args *); -void cmd_find_window_match(struct cmd_find_window_list *, int, - struct winlink *, const char *, const char *); +static u_int cmd_find_window_match_flags(struct args *); +static void cmd_find_window_match(struct cmd_find_window_list *, int, + struct winlink *, const char *, const char *); -u_int +static u_int cmd_find_window_match_flags(struct args *args) { u_int match_flags = 0; @@ -92,7 +92,7 @@ cmd_find_window_match_flags(struct args *args) return (match_flags); } -void +static void cmd_find_window_match(struct cmd_find_window_list *find_list, int match_flags, struct winlink *wl, const char *str, const char *searchstr) @@ -138,7 +138,7 @@ cmd_find_window_match(struct cmd_find_window_list *find_list, free(find_data); } -enum cmd_retval +static enum cmd_retval cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -216,7 +216,7 @@ out: return (CMD_RETURN_NORMAL); } -void +static void cmd_find_window_callback(struct window_choose_data *cdata) { struct session *s; @@ -27,33 +27,35 @@ #include "tmux.h" -struct session *cmd_find_try_TMUX(struct client *, struct window *); -int cmd_find_client_better(struct client *, struct client *); -struct client *cmd_find_best_client(struct client **, u_int); -int cmd_find_session_better(struct session *, struct session *, - int); -struct session *cmd_find_best_session(struct session **, u_int, int); -int cmd_find_best_session_with_window(struct cmd_find_state *); -int cmd_find_best_winlink_with_window(struct cmd_find_state *); - -int cmd_find_current_session_with_client(struct cmd_find_state *); -int cmd_find_current_session(struct cmd_find_state *); -struct client *cmd_find_current_client(struct cmd_q *); - -const char *cmd_find_map_table(const char *[][2], const char *); - -int cmd_find_get_session(struct cmd_find_state *, const char *); -int cmd_find_get_window(struct cmd_find_state *, const char *); -int cmd_find_get_window_with_session(struct cmd_find_state *, const char *); -int cmd_find_get_window_with_pane(struct cmd_find_state *); -int cmd_find_get_pane(struct cmd_find_state *, const char *); -int cmd_find_get_pane_with_session(struct cmd_find_state *, const char *); -int cmd_find_get_pane_with_window(struct cmd_find_state *, const char *); - -const char *cmd_find_session_table[][2] = { +static struct session *cmd_find_try_TMUX(struct client *, struct window *); +static int cmd_find_client_better(struct client *, struct client *); +static struct client *cmd_find_best_client(struct client **, u_int); +static int cmd_find_session_better(struct session *, struct session *, + int); +static struct session *cmd_find_best_session(struct session **, u_int, int); +static int cmd_find_best_session_with_window(struct cmd_find_state *); +static int cmd_find_best_winlink_with_window(struct cmd_find_state *); + +static int cmd_find_current_session_with_client(struct cmd_find_state *); +static int cmd_find_current_session(struct cmd_find_state *); +static struct client *cmd_find_current_client(struct cmd_q *); + +static const char *cmd_find_map_table(const char *[][2], const char *); + +static int cmd_find_get_session(struct cmd_find_state *, const char *); +static int cmd_find_get_window(struct cmd_find_state *, const char *); +static int cmd_find_get_window_with_session(struct cmd_find_state *, + const char *); +static int cmd_find_get_pane(struct cmd_find_state *, const char *); +static int cmd_find_get_pane_with_session(struct cmd_find_state *, + const char *); +static int cmd_find_get_pane_with_window(struct cmd_find_state *, + const char *); + +static const char *cmd_find_session_table[][2] = { { NULL, NULL } }; -const char *cmd_find_window_table[][2] = { +static const char *cmd_find_window_table[][2] = { { "{start}", "^" }, { "{last}", "!" }, { "{end}", "$" }, @@ -61,7 +63,7 @@ const char *cmd_find_window_table[][2] = { { "{previous}", "-" }, { NULL, NULL } }; -const char *cmd_find_pane_table[][2] = { +static const char *cmd_find_pane_table[][2] = { { "{last}", "!" }, { "{next}", "+" }, { "{previous}", "-" }, @@ -81,7 +83,7 @@ const char *cmd_find_pane_table[][2] = { }; /* Get session from TMUX if present. */ -struct session * +static struct session * cmd_find_try_TMUX(struct client *c, struct window *w) { struct environ_entry *envent; @@ -108,7 +110,7 @@ cmd_find_try_TMUX(struct client *c, struct window *w) } /* Is this client better? */ -int +static int cmd_find_client_better(struct client *c, struct client *than) { if (than == NULL) @@ -117,7 +119,7 @@ cmd_find_client_better(struct client *c, struct client *than) } /* Find best client from a list, or all if list is NULL. */ -struct client * +static struct client * cmd_find_best_client(struct client **clist, u_int csize) { struct client *c_loop, *c; @@ -143,7 +145,7 @@ cmd_find_best_client(struct client **clist, u_int csize) } /* Is this session better? */ -int +static int cmd_find_session_better(struct session *s, struct session *than, int flags) { int attached; @@ -161,7 +163,7 @@ cmd_find_session_better(struct session *s, struct session *than, int flags) } /* Find best session from a list, or all if list is NULL. */ -struct session * +static struct session * cmd_find_best_session(struct session **slist, u_int ssize, int flags) { struct session *s_loop, *s; @@ -183,7 +185,7 @@ cmd_find_best_session(struct session **slist, u_int ssize, int flags) } /* Find best session and winlink for window. */ -int +static int cmd_find_best_session_with_window(struct cmd_find_state *fs) { struct session **slist = NULL; @@ -220,7 +222,7 @@ fail: * Find the best winlink for a window (the current if it contains the pane, * otherwise the first). */ -int +static int cmd_find_best_winlink_with_window(struct cmd_find_state *fs) { struct winlink *wl, *wl_loop; @@ -244,7 +246,7 @@ cmd_find_best_winlink_with_window(struct cmd_find_state *fs) } /* Find current session when we have an unattached client. */ -int +static int cmd_find_current_session_with_client(struct cmd_find_state *fs) { struct window_pane *wp; @@ -308,7 +310,7 @@ unknown_pane: * Work out the best current state. If this function succeeds, the state is * guaranteed to be completely filled in. */ -int +static int cmd_find_current_session(struct cmd_find_state *fs) { /* If we know the current client, use it. */ @@ -338,7 +340,7 @@ cmd_find_current_session(struct cmd_find_state *fs) } /* Work out the best current client. */ -struct client * +static struct client * cmd_find_current_client(struct cmd_q *cmdq) { struct cmd_find_state current; @@ -384,7 +386,7 @@ cmd_find_current_client(struct cmd_q *cmdq) } /* Maps string in table. */ -const char * +static const char * cmd_find_map_table(const char *table[][2], const char *s) { u_int i; @@ -397,7 +399,7 @@ cmd_find_map_table(const char *table[][2], const char *s) |