diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2016-10-10 21:29:24 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2016-10-10 21:29:24 +0000 |
commit | cdc48fa9a174dd3320820c9e10f6c4985a30aedf (patch) | |
tree | e81384a8ee4d7982fb991136d3097cd1e77ccf0d /usr.bin | |
parent | 73c685014d1cbbe0b06df8e75e471e757fc66e06 (diff) |
Loads more static, except for cmd-*.c and window-*.c.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/cfg.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/environ.c | 9 | ||||
-rw-r--r-- | usr.bin/tmux/format.c | 125 | ||||
-rw-r--r-- | usr.bin/tmux/grid.c | 37 | ||||
-rw-r--r-- | usr.bin/tmux/hooks.c | 5 | ||||
-rw-r--r-- | usr.bin/tmux/job.c | 10 | ||||
-rw-r--r-- | usr.bin/tmux/key-string.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/layout-set.c | 20 | ||||
-rw-r--r-- | usr.bin/tmux/mode-key.c | 20 | ||||
-rw-r--r-- | usr.bin/tmux/names.c | 10 | ||||
-rw-r--r-- | usr.bin/tmux/notify.c | 17 | ||||
-rw-r--r-- | usr.bin/tmux/options.c | 5 | ||||
-rw-r--r-- | usr.bin/tmux/procname.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/screen-redraw.c | 52 | ||||
-rw-r--r-- | usr.bin/tmux/screen.c | 14 | ||||
-rw-r--r-- | usr.bin/tmux/server-client.c | 60 | ||||
-rw-r--r-- | usr.bin/tmux/server-fn.c | 10 | ||||
-rw-r--r-- | usr.bin/tmux/server.c | 41 | ||||
-rw-r--r-- | usr.bin/tmux/session.c | 24 | ||||
-rw-r--r-- | usr.bin/tmux/signal.c | 14 | ||||
-rw-r--r-- | usr.bin/tmux/status.c | 70 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/tty-keys.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/tty-term.c | 12 | ||||
-rw-r--r-- | usr.bin/tmux/tty.c | 71 |
25 files changed, 332 insertions, 326 deletions
diff --git a/usr.bin/tmux/cfg.c b/usr.bin/tmux/cfg.c index 81518a58484..5c37f095512 100644 --- a/usr.bin/tmux/cfg.c +++ b/usr.bin/tmux/cfg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfg.c,v 1.45 2016/05/12 16:05:33 tim Exp $ */ +/* $OpenBSD: cfg.c,v 1.46 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -36,7 +36,7 @@ char **cfg_causes; u_int cfg_ncauses; struct client *cfg_client; -void cfg_default_done(struct cmd_q *); +static void cfg_default_done(struct cmd_q *); void set_cfg_file(const char *path) @@ -126,7 +126,7 @@ load_cfg(const char *path, struct cmd_q *cmdq, int quiet) return (found); } -void +static void cfg_default_done(__unused struct cmd_q *cmdq) { if (--cfg_references != 0) diff --git a/usr.bin/tmux/environ.c b/usr.bin/tmux/environ.c index c184dd1d51f..74772c86a46 100644 --- a/usr.bin/tmux/environ.c +++ b/usr.bin/tmux/environ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: environ.c,v 1.15 2016/07/15 09:52:34 nicm Exp $ */ +/* $OpenBSD: environ.c,v 1.16 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -28,11 +28,10 @@ */ RB_HEAD(environ, environ_entry); -int environ_cmp(struct environ_entry *, struct environ_entry *); -RB_PROTOTYPE(environ, environ_entry, entry, environ_cmp); -RB_GENERATE(environ, environ_entry, entry, environ_cmp); +static int environ_cmp(struct environ_entry *, struct environ_entry *); +RB_GENERATE_STATIC(environ, environ_entry, entry, environ_cmp); -int +static int environ_cmp(struct environ_entry *envent1, struct environ_entry *envent2) { return (strcmp(envent1->name, envent2->name)); diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 16d495748df..bb988ac9a3e 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.107 2016/05/23 20:39:26 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.108 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -39,34 +39,41 @@ struct format_entry; typedef void (*format_cb)(struct format_tree *, struct format_entry *); -void format_job_callback(struct job *); -char *format_job_get(struct format_tree *, const char *); -void format_job_timer(int, short, void *); - -void format_cb_host(struct format_tree *, struct format_entry *); -void format_cb_host_short(struct format_tree *, struct format_entry *); -void format_cb_pid(struct format_tree *, struct format_entry *); -void format_cb_session_alerts(struct format_tree *, struct format_entry *); -void format_cb_window_layout(struct format_tree *, struct format_entry *); -void format_cb_window_visible_layout(struct format_tree *, - struct format_entry *); -void format_cb_start_command(struct format_tree *, struct format_entry *); -void format_cb_current_command(struct format_tree *, struct format_entry *); -void format_cb_history_bytes(struct format_tree *, struct format_entry *); -void format_cb_pane_tabs(struct format_tree *, struct format_entry *); - -char *format_find(struct format_tree *, const char *, int); -void format_add_cb(struct format_tree *, const char *, format_cb); -void format_add_tv(struct format_tree *, const char *, struct timeval *); -int format_replace(struct format_tree *, const char *, size_t, char **, - size_t *, size_t *); -char *format_time_string(time_t); - -void format_defaults_pane_tabs(struct format_tree *, struct window_pane *); -void format_defaults_session(struct format_tree *, struct session *); -void format_defaults_client(struct format_tree *, struct client *); -void format_defaults_winlink(struct format_tree *, struct session *, - struct winlink *); +static void format_job_callback(struct job *); +static char *format_job_get(struct format_tree *, const char *); +static void format_job_timer(int, short, void *); + +static void format_cb_host(struct format_tree *, struct format_entry *); +static void format_cb_host_short(struct format_tree *, + struct format_entry *); +static void format_cb_pid(struct format_tree *, struct format_entry *); +static void format_cb_session_alerts(struct format_tree *, + struct format_entry *); +static void format_cb_window_layout(struct format_tree *, + struct format_entry *); +static void format_cb_window_visible_layout(struct format_tree *, + struct format_entry *); +static void format_cb_start_command(struct format_tree *, + struct format_entry *); +static void format_cb_current_command(struct format_tree *, + struct format_entry *); +static void format_cb_history_bytes(struct format_tree *, + struct format_entry *); +static void format_cb_pane_tabs(struct format_tree *, + struct format_entry *); + +static char *format_find(struct format_tree *, const char *, int); +static void format_add_cb(struct format_tree *, const char *, format_cb); +static void format_add_tv(struct format_tree *, const char *, + struct timeval *); +static int format_replace(struct format_tree *, const char *, size_t, + char **, size_t *, size_t *); + +static void format_defaults_session(struct format_tree *, + struct session *); +static void format_defaults_client(struct format_tree *, struct client *); +static void format_defaults_winlink(struct format_tree *, struct session *, + struct winlink *); /* Entry in format job tree. */ struct format_job { @@ -82,14 +89,13 @@ struct format_job { }; /* Format job tree. */ -struct event format_job_event; -int format_job_cmp(struct format_job *, struct format_job *); +static struct event format_job_event; +static int format_job_cmp(struct format_job *, struct format_job *); RB_HEAD(format_job_tree, format_job) format_jobs = RB_INITIALIZER(); -RB_PROTOTYPE(format_job_tree, format_job, entry, format_job_cmp); -RB_GENERATE(format_job_tree, format_job, entry, format_job_cmp); +RB_GENERATE_STATIC(format_job_tree, format_job, entry, format_job_cmp); /* Format job tree comparison function. */ -int +static int format_job_cmp(struct format_job *fj1, struct format_job *fj2) { return (strcmp(fj1->cmd, fj2->cmd)); @@ -120,19 +126,18 @@ struct format_tree { RB_HEAD(format_entry_tree, format_entry) tree; }; -int format_entry_cmp(struct format_entry *, struct format_entry *); -RB_PROTOTYPE(format_entry_tree, format_entry, entry, format_entry_cmp); -RB_GENERATE(format_entry_tree, format_entry, entry, format_entry_cmp); +static int format_entry_cmp(struct format_entry *, struct format_entry *); +RB_GENERATE_STATIC(format_entry_tree, format_entry, entry, format_entry_cmp); /* Format entry tree comparison function. */ -int +static int format_entry_cmp(struct format_entry *fe1, struct format_entry *fe2) { return (strcmp(fe1->key, fe2->key)); } /* Single-character uppercase aliases. */ -const char *format_upper[] = { +static const char *format_upper[] = { NULL, /* A */ NULL, /* B */ NULL, /* C */ @@ -162,7 +167,7 @@ const char *format_upper[] = { }; /* Single-character lowercase aliases. */ -const char *format_lower[] = { +static const char *format_lower[] = { NULL, /* a */ NULL, /* b */ NULL, /* c */ @@ -192,7 +197,7 @@ const char *format_lower[] = { }; /* Format job callback. */ -void +static void format_job_callback(struct job *job) { struct format_job *fj = job->data; @@ -224,7 +229,7 @@ format_job_callback(struct job *job) } /* Find a job. */ -char * +static char * format_job_get(struct format_tree *ft, const char *cmd) { struct format_job fj0, *fj; @@ -258,7 +263,7 @@ format_job_get(struct format_tree *ft, const char *cmd) } /* Remove old jobs. */ -void +static void format_job_timer(__unused int fd, __unused short events, __unused void *arg) { struct format_job *fj, *fj1; @@ -287,7 +292,7 @@ format_job_timer(__unused int fd, __unused short events, __unused void *arg) } /* Callback for host. */ -void +static void format_cb_host(__unused struct format_tree *ft, struct format_entry *fe) { char host[HOST_NAME_MAX + 1]; @@ -299,7 +304,7 @@ format_cb_host(__unused struct format_tree *ft, struct format_entry *fe) } /* Callback for host_short. */ -void +static void format_cb_host_short(__unused struct format_tree *ft, struct format_entry *fe) { char host[HOST_NAME_MAX + 1], *cp; @@ -314,14 +319,14 @@ format_cb_host_short(__unused struct format_tree *ft, struct format_entry *fe) } /* Callback for pid. */ -void +static void format_cb_pid(__unused struct format_tree *ft, struct format_entry *fe) { xasprintf(&fe->value, "%ld", (long)getpid()); } /* Callback for session_alerts. */ -void +static void format_cb_session_alerts(struct format_tree *ft, struct format_entry *fe) { struct session *s = ft->s; @@ -351,7 +356,7 @@ format_cb_session_alerts(struct format_tree *ft, struct format_entry *fe) } /* Callback for window_layout. */ -void +static void format_cb_window_layout(struct format_tree *ft, struct format_entry *fe) { struct window *w = ft->w; @@ -366,7 +371,7 @@ format_cb_window_layout(struct format_tree *ft, struct format_entry *fe) } /* Callback for window_visible_layout. */ -void +static void format_cb_window_visible_layout(struct format_tree *ft, struct format_entry *fe) { struct window *w = ft->w; @@ -378,7 +383,7 @@ format_cb_window_visible_layout(struct format_tree *ft, struct format_entry *fe) } /* Callback for pane_start_command. */ -void +static void format_cb_start_command(struct format_tree *ft, struct format_entry *fe) { struct window_pane *wp = ft->wp; @@ -390,7 +395,7 @@ format_cb_start_command(struct format_tree *ft, struct format_entry *fe) } /* Callback for pane_current_command. */ -void +static void format_cb_current_command(struct format_tree *ft, struct format_entry *fe) { struct window_pane *wp = ft->wp; @@ -413,7 +418,7 @@ format_cb_current_command(struct format_tree *ft, struct format_entry *fe) } /* Callback for history_bytes. */ -void +static void format_cb_history_bytes(struct format_tree *ft, struct format_entry *fe) { struct window_pane *wp = ft->wp; @@ -438,7 +443,7 @@ format_cb_history_bytes(struct format_tree *ft, struct format_entry *fe) } /* Callback for pane_tabs. */ -void +static void format_cb_pane_tabs(struct format_tree *ft, struct format_entry *fe) { struct window_pane *wp = ft->wp; @@ -539,7 +544,7 @@ format_add(struct format_tree *ft, const char *key, const char *fmt, ...) } /* Add a key and time. */ -void +static void format_add_tv(struct format_tree *ft, const char *key, struct timeval *tv) { struct format_entry *fe; @@ -563,7 +568,7 @@ format_add_tv(struct format_tree *ft, const char *key, struct timeval *tv) } /* Add a key and function. */ -void +static void format_add_cb(struct format_tree *ft, const char *key, format_cb cb) { struct format_entry *fe; @@ -587,7 +592,7 @@ format_add_cb(struct format_tree *ft, const char *key, format_cb cb) } /* Find a format entry. */ -char * +static char * format_find(struct format_tree *ft, const char *key, int modifiers) { struct format_entry *fe, fe_find; @@ -682,7 +687,7 @@ found: * Replace a key/value pair in buffer. #{blah} is expanded directly, * #{?blah,a,b} is replace with a if blah exists and is nonzero else b. */ -int +static int format_replace(struct format_tree *ft, const char *key, size_t keylen, char **buf, size_t *len, size_t *off) { @@ -1002,7 +1007,7 @@ format_defaults(struct format_tree *ft, struct client *c, struct session *s, } /* Set default format keys for a session. */ -void +static void format_defaults_session(struct format_tree *ft, struct session *s) { struct session_group *sg; @@ -1031,7 +1036,7 @@ format_defaults_session(struct format_tree *ft, struct session *s) } /* Set default format keys for a client. */ -void +static void format_defaults_client(struct format_tree *ft, struct client *c) { struct session *s; @@ -1098,7 +1103,7 @@ format_defaults_window(struct format_tree *ft, struct window *w) } /* Set default format keys for a winlink. */ -void +static void format_defaults_winlink(struct format_tree *ft, struct session *s, struct winlink *wl) { diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c index 364eaba687b..2ea6162ad0e 100644 --- a/usr.bin/tmux/grid.c +++ b/usr.bin/tmux/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.55 2016/09/02 20:57:20 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.56 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -43,16 +43,17 @@ const struct grid_cell_entry grid_default_entry = { 0, { .data = { 0, 8, 8, ' ' } } }; -void grid_reflow_copy(struct grid_line *, u_int, struct grid_line *l, - u_int, u_int); -void grid_reflow_join(struct grid *, u_int *, struct grid_line *, u_int); -void grid_reflow_split(struct grid *, u_int *, struct grid_line *, u_int, - u_int); -void grid_reflow_move(struct grid *, u_int *, struct grid_line *); -size_t grid_string_cells_fg(const struct grid_cell *, int *); -size_t grid_string_cells_bg(const struct grid_cell *, int *); -void grid_string_cells_code(const struct grid_cell *, - const struct grid_cell *, char *, size_t, int); +static void grid_reflow_copy(struct grid_line *, u_int, struct grid_line *, + u_int, u_int); +static void grid_reflow_join(struct grid *, u_int *, struct grid_line *, + u_int); +static void grid_reflow_split(struct grid *, u_int *, struct grid_line *, + u_int, u_int); +static void grid_reflow_move(struct grid *, u_int *, struct grid_line *); +static size_t grid_string_cells_fg(const struct grid_cell *, int *); +static size_t grid_string_cells_bg(const struct grid_cell *, int *); +static void grid_string_cells_code(const struct grid_cell *, + const struct grid_cell *, char *, size_t, int); /* Copy default into a cell. */ static void @@ -473,7 +474,7 @@ grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx) } /* Get ANSI foreground sequence. */ -size_t +static size_t grid_string_cells_fg(const struct grid_cell *gc, int *values) { size_t n; @@ -522,7 +523,7 @@ grid_string_cells_fg(const struct grid_cell *gc, int *values) } /* Get ANSI background sequence. */ -size_t +static size_t grid_string_cells_bg(const struct grid_cell *gc, int *values) { size_t n; @@ -575,7 +576,7 @@ grid_string_cells_bg(const struct grid_cell *gc, int *values) * given a current state. The output buffer must be able to hold at least 57 * bytes. */ -void +static void grid_string_cells_code(const struct grid_cell *lastgc, const struct grid_cell *gc, char *buf, size_t len, int escape_c0) { @@ -773,7 +774,7 @@ grid_duplicate_lines(struct grid *dst, u_int dy, struct grid *src, u_int sy, } /* Copy a section of a line. */ -void +static void grid_reflow_copy(struct grid_line *dst_gl, u_int to, struct grid_line *src_gl, u_int from, u_int to_copy) { @@ -798,7 +799,7 @@ grid_reflow_copy(struct grid_line *dst_gl, u_int to, struct grid_line *src_gl, } /* Join line data. */ -void +static void grid_reflow_join(struct grid *dst, u_int *py, struct grid_line *src_gl, u_int new_x) { @@ -833,7 +834,7 @@ grid_reflow_join(struct grid *dst, u_int *py, struct grid_line *src_gl, } /* Split line data. */ -void +static void grid_reflow_split(struct grid *dst, u_int *py, struct grid_line *src_gl, u_int new_x, u_int offset) { @@ -873,7 +874,7 @@ grid_reflow_split(struct grid *dst, u_int *py, struct grid_line *src_gl, } /* Move line data. */ -void +static void grid_reflow_move(struct grid *dst, u_int *py, struct grid_line *src_gl) { struct grid_line *dst_gl; diff --git a/usr.bin/tmux/hooks.c b/usr.bin/tmux/hooks.c index 386ac68179c..ca45395acdd 100644 --- a/usr.bin/tmux/hooks.c +++ b/usr.bin/tmux/hooks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hooks.c,v 1.4 2015/12/16 21:50:37 nicm Exp $ */ +/* $OpenBSD: hooks.c,v 1.5 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2012 Thomas Adam <thomas@xteddy.org> @@ -29,8 +29,7 @@ struct hooks { }; static int hooks_cmp(struct hook *, struct hook *); -RB_PROTOTYPE(hooks_tree, hook, entry, hooks_cmp); -RB_GENERATE(hooks_tree, hook, entry, hooks_cmp); +RB_GENERATE_STATIC(hooks_tree, hook, entry, hooks_cmp); static struct hook *hooks_find1(struct hooks *, const char *); static void hooks_free1(struct hooks *, struct hook *); diff --git a/usr.bin/tmux/job.c b/usr.bin/tmux/job.c index ea998b3fb93..7f037b295cc 100644 --- a/usr.bin/tmux/job.c +++ b/usr.bin/tmux/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.40 2016/01/19 15:59:12 nicm Exp $ */ +/* $OpenBSD: job.c,v 1.41 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -33,8 +33,8 @@ * output. */ -void job_callback(struct bufferevent *, short, void *); -void job_write_callback(struct bufferevent *, void *); +static void job_callback(struct bufferevent *, short, void *); +static void job_write_callback(struct bufferevent *, void *); /* All jobs list. */ struct joblist all_jobs = LIST_HEAD_INITIALIZER(all_jobs); @@ -149,7 +149,7 @@ job_free(struct job *job) } /* Called when output buffer falls below low watermark (default is 0). */ -void +static void job_write_callback(__unused struct bufferevent *bufev, void *data) { struct job *job = data; @@ -165,7 +165,7 @@ job_write_callback(__unused struct bufferevent *bufev, void *data) } /* Job buffer error callback. */ -void +static void job_callback(__unused struct bufferevent *bufev, __unused short events, void *data) { diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c index b78e0bb288e..1040943d5e8 100644 --- a/usr.bin/tmux/key-string.c +++ b/usr.bin/tmux/key-string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-string.c,v 1.38 2016/05/26 14:49:48 nicm Exp $ */ +/* $OpenBSD: key-string.c,v 1.39 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -25,7 +25,7 @@ static key_code key_string_search_table(const char *); static key_code key_string_get_modifiers(const char **); -const struct { +static const struct { const char *string; key_code key; } key_string_table[] = { diff --git a/usr.bin/tmux/layout-set.c b/usr.bin/tmux/layout-set.c index dfea56a01ed..228e2061966 100644 --- a/usr.bin/tmux/layout-set.c +++ b/usr.bin/tmux/layout-set.c @@ -1,4 +1,4 @@ -/* $OpenBSD: layout-set.c,v 1.15 2016/08/03 09:07:02 nicm Exp $ */ +/* $OpenBSD: layout-set.c,v 1.16 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -27,11 +27,11 @@ * one-off and generate a layout tree. */ -void layout_set_even_h(struct window *); -void layout_set_even_v(struct window *); -void layout_set_main_h(struct window *); -void layout_set_main_v(struct window *); -void layout_set_tiled(struct window *); +static void layout_set_even_h(struct window *); +static void layout_set_even_v(struct window *); +static void layout_set_main_h(struct window *); +static void layout_set_main_v(struct window *); +static void layout_set_tiled(struct window *); const struct { const char *name; @@ -114,7 +114,7 @@ layout_set_previous(struct window *w) return (layout); } -void +static void layout_set_even_h(struct window *w) { struct window_pane *wp; @@ -168,7 +168,7 @@ layout_set_even_h(struct window *w) server_redraw_window(w); } -void +static void layout_set_even_v(struct window *w) { struct window_pane *wp; @@ -222,7 +222,7 @@ layout_set_even_v(struct window *w) server_redraw_window(w); } -void +static void layout_set_main_h(struct window *w) { struct window_pane *wp; @@ -345,7 +345,7 @@ layout_set_main_h(struct window *w) server_redraw_window(w); } -void +static void layout_set_main_v(struct window *w) { struct window_pane *wp; diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c index 43fd16351f8..cd60c35d99c 100644 --- a/usr.bin/tmux/mode-key.c +++ b/usr.bin/tmux/mode-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mode-key.c,v 1.69 2016/09/12 15:40:58 nicm Exp $ */ +/* $OpenBSD: mode-key.c,v 1.70 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -54,7 +54,7 @@ struct mode_key_entry { }; /* Edit keys command strings. */ -const struct mode_key_cmdstr mode_key_cmdstr_edit[] = { +static const struct mode_key_cmdstr mode_key_cmdstr_edit[] = { { MODEKEYEDIT_BACKSPACE, "backspace" }, { MODEKEYEDIT_CANCEL, "cancel" }, { MODEKEYEDIT_COMPLETE, "complete" }, @@ -89,7 +89,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_edit[] = { }; /* Choice keys command strings. */ -const struct mode_key_cmdstr mode_key_cmdstr_choice[] = { +static const struct mode_key_cmdstr mode_key_cmdstr_choice[] = { { MODEKEYCHOICE_BACKSPACE, "backspace" }, { MODEKEYCHOICE_BOTTOMLINE, "bottom-line"}, { MODEKEYCHOICE_CANCEL, "cancel" }, @@ -114,7 +114,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_choice[] = { }; /* Copy keys command strings. */ -const struct mode_key_cmdstr mode_key_cmdstr_copy[] = { +static const struct mode_key_cmdstr mode_key_cmdstr_copy[] = { { MODEKEYCOPY_APPENDSELECTION, "append-selection" }, { MODEKEYCOPY_BACKTOINDENTATION, "back-to-indentation" }, { MODEKEYCOPY_BOTTOMLINE, "bottom-line" }, @@ -170,7 +170,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_copy[] = { }; /* vi editing keys. */ -const struct mode_key_entry mode_key_vi_edit[] = { +static const struct mode_key_entry mode_key_vi_edit[] = { { '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL, 1 }, { '\010' /* C-h */, 0, MODEKEYEDIT_BACKSPACE, 1 }, { '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE, 1 }, @@ -229,7 +229,7 @@ const struct mode_key_entry mode_key_vi_edit[] = { struct mode_key_tree mode_key_tree_vi_edit; /* vi choice selection keys. */ -const struct mode_key_entry mode_key_vi_choice[] = { +static const struct mode_key_entry mode_key_vi_choice[] = { { '0' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 }, { '1' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 }, { '2' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 }, @@ -278,7 +278,7 @@ const struct mode_key_entry mode_key_vi_choice[] = { struct mode_key_tree mode_key_tree_vi_choice; /* vi copy mode keys. */ -const struct mode_key_entry mode_key_vi_copy[] = { +static const struct mode_key_entry mode_key_vi_copy[] = { { ' ', 0, MODEKEYCOPY_STARTSELECTION, 1 }, { '"', 0, MODEKEYCOPY_STARTNAMEDBUFFER, 1 }, { '$', 0, MODEKEYCOPY_ENDOFLINE, 1 }, @@ -359,7 +359,7 @@ const struct mode_key_entry mode_key_vi_copy[] = { struct mode_key_tree mode_key_tree_vi_copy; /* emacs editing keys. */ -const struct mode_key_entry mode_key_emacs_edit[] = { +static const struct mode_key_entry mode_key_emacs_edit[] = { { '\001' /* C-a */, 0, MODEKEYEDIT_STARTOFLINE, 1 }, { '\002' /* C-b */, 0, MODEKEYEDIT_CURSORLEFT, 1 }, { '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL, 1 }, @@ -395,7 +395,7 @@ const struct mode_key_entry mode_key_emacs_edit[] = { struct mode_key_tree mode_key_tree_emacs_edit; /* emacs choice selection keys. */ -const struct mode_key_entry mode_key_emacs_choice[] = { +static const struct mode_key_entry mode_key_emacs_choice[] = { { '0' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 }, { '1' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 }, { '2' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 }, @@ -442,7 +442,7 @@ const struct mode_key_entry mode_key_emacs_choice[] = { struct mode_key_tree mode_key_tree_emacs_choice; /* emacs copy mode keys. */ -const struct mode_key_entry mode_key_emacs_copy[] = { +static const struct mode_key_entry mode_key_emacs_copy[] = { { ' ', 0, MODEKEYCOPY_NEXTPAGE, 1 }, { ',', 0, MODEKEYCOPY_JUMPREVERSE, 1 }, { ';', 0, MODEKEYCOPY_JUMPAGAIN, 1 }, diff --git a/usr.bin/tmux/names.c b/usr.bin/tmux/names.c index f9d6e88ab42..15c0ad00227 100644 --- a/usr.bin/tmux/names.c +++ b/usr.bin/tmux/names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: names.c,v 1.35 2016/07/15 09:27:35 nicm Exp $ */ +/* $OpenBSD: names.c,v 1.36 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -25,10 +25,10 @@ #include "tmux.h" -void name_time_callback(int, short, void *); -int name_time_expired(struct window *, struct timeval *); +static void name_time_callback(int, short, void *); +static int name_time_expired(struct window *, struct timeval *); -void +static void name_time_callback(__unused int fd, __unused short events, void *arg) { struct window *w = arg; @@ -37,7 +37,7 @@ name_time_callback(__unused int fd, __unused short events, void *arg) log_debug("@%u name timer expired", w->id); } -int +static int name_time_expired(struct window *w, struct timeval *tv) { struct timeval offset; diff --git a/usr.bin/tmux/notify.c b/usr.bin/tmux/notify.c index e9a8cfeeb56..b058bde531b 100644 --- a/usr.bin/tmux/notify.c +++ b/usr.bin/tmux/notify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: notify.c,v 1.8 2015/06/05 18:18:32 nicm Exp $ */ +/* $OpenBSD: notify.c,v 1.9 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2012 George Nachman <tmux@georgester.com> @@ -43,12 +43,13 @@ struct notify_entry { TAILQ_ENTRY(notify_entry) entry; }; -TAILQ_HEAD(, notify_entry) notify_queue = TAILQ_HEAD_INITIALIZER(notify_queue); -int notify_enabled = 1; +TAILQ_HEAD(notify_queue, notify_entry); +static struct notify_queue notify_queue = TAILQ_HEAD_INITIALIZER(notify_queue); +static int notify_enabled = 1; -void notify_drain(void); -void notify_add(enum notify_type, struct client *, struct session *, - struct window *); +static void notify_drain(void); +static void notify_add(enum notify_type, struct client *, struct session *, + struct window *); void notify_enable(void) @@ -63,7 +64,7 @@ notify_disable(void) notify_enabled = 0; } -void +static void notify_add(enum notify_type type, struct client *c, struct session *s, struct window *w) { @@ -84,7 +85,7 @@ notify_add(enum notify_type type, struct client *c, struct session *s, w->references++; } -void +static void notify_drain(void) { struct notify_entry *ne, *ne1; diff --git a/usr.bin/tmux/options.c b/usr.bin/tmux/options.c index 2e7185c5f75..ff3cfc8f9ef 100644 --- a/usr.bin/tmux/options.c +++ b/usr.bin/tmux/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.19 2016/09/26 09:02:34 nicm Exp $ */ +/* $OpenBSD: options.c,v 1.20 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -35,8 +35,7 @@ struct options { }; static int options_cmp(struct options_entry *, struct options_entry *); -RB_PROTOTYPE(options_tree, options_entry, entry, options_cmp); -RB_GENERATE(options_tree, options_entry, entry, options_cmp); +RB_GENERATE_STATIC(options_tree, options_entry, entry, options_cmp); static void options_free1(struct options *, struct options_entry *); diff --git a/usr.bin/tmux/procname.c b/usr.bin/tmux/procname.c index 30af6664443..121031badbb 100644 --- a/usr.bin/tmux/procname.c +++ b/usr.bin/tmux/procname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procname.c,v 1.15 2016/01/19 15:59:12 nicm Exp $ */ +/* $OpenBSD: procname.c,v 1.16 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -36,10 +36,10 @@ #define is_stopped(p) \ ((p)->p_stat == SSTOP || (p)->p_stat == SDEAD) -struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *); -char *get_proc_name(int, char *); +static struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *); +char *get_proc_name(int, char *); -struct kinfo_proc * +static struct kinfo_proc * cmp_procs(struct kinfo_proc *p1, struct kinfo_proc *p2) { if (is_runnable(p1) && !is_runnable(p2)) diff --git a/usr.bin/tmux/screen-redraw.c b/usr.bin/tmux/screen-redraw.c index 0d0191a2e9c..634f6ad8051 100644 --- a/usr.bin/tmux/screen-redraw.c +++ b/usr.bin/tmux/screen-redraw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-redraw.c,v 1.38 2016/10/09 16:24:34 nicm Exp $ */ +/* $OpenBSD: screen-redraw.c,v 1.39 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -22,21 +22,22 @@ #include "tmux.h" -int screen_redraw_cell_border1(struct window_pane *, u_int, u_int); -int screen_redraw_cell_border(struct client *, u_int, u_int); -int screen_redraw_check_cell(struct client *, u_int, u_int, int, - struct window_pane **); -int screen_redraw_check_is(u_int, u_int, int, int, struct window *, - struct window_pane *, struct window_pane *); +static int screen_redraw_cell_border1(struct window_pane *, u_int, u_int); +static int screen_redraw_cell_border(struct client *, u_int, u_int); +static int screen_redraw_check_cell(struct client *, u_int, u_int, int, + struct window_pane **); +static int screen_redraw_check_is(u_int, u_int, int, int, struct window *, + struct window_pane *, struct window_pane *); -int screen_redraw_make_pane_status(struct client *, struct window *, - struct window_pane *); -void screen_redraw_draw_pane_status(struct client *, int); +static int screen_redraw_make_pane_status(struct client *, struct window *, + struct window_pane *); +static void screen_redraw_draw_pane_status(struct client *, int); -void screen_redraw_draw_borders(struct client *, int, int, u_int); -void screen_redraw_draw_panes(struct client *, u_int); -void screen_redraw_draw_status(struct client *, u_int); -void screen_redraw_draw_number(struct client *, struct window_pane *, u_int); +static void screen_redraw_draw_borders(struct client *, int, int, u_int); +static void screen_redraw_draw_panes(struct client *, u_int); +static void screen_redraw_draw_status(struct client *, u_int); +static void screen_redraw_draw_number(struct client *, struct window_pane *, + u_int); #define CELL_INSIDE 0 #define CELL_LEFTRIGHT 1 @@ -59,7 +60,7 @@ void screen_redraw_draw_number(struct client *, struct window_pane *, u_int); #define CELL_STATUS_BOTTOM 2 /* Check if cell is on the border of a particular pane. */ -int +static int screen_redraw_cell_border1(struct window_pane *wp, u_int px, u_int py) { /* Inside pane. */ @@ -88,7 +89,7 @@ screen_redraw_cell_border1(struct window_pane *wp, u_int px, u_int py) } /* Check if a cell is on the pane border. */ -int +static int screen_redraw_cell_border(struct client *c, u_int px, u_int py) { struct window *w = c->session->curw->window; @@ -107,7 +108,7 @@ screen_redraw_cell_border(struct client *c, u_int px, u_int py) } /* Check if cell inside a pane. */ -int +static int screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status, struct window_pane **wpp) { @@ -116,6 +117,8 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status, int borders; u_int right, line; + *wpp = NULL; + if (px > w->sx || py > w->sy) return (CELL_OUTSIDE); @@ -201,12 +204,11 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status, } } - *wpp = NULL; return (CELL_OUTSIDE); } /* Check if the border of a particular pane. */ -int +static int screen_redraw_check_is(u_int px, u_int py, int type, int pane_status, struct window *w, struct window_pane *wantwp, struct window_pane *wp) { @@ -259,7 +261,7 @@ screen_redraw_check_is(u_int px, u_int py, int type, int pane_status, } /* Update pane status. */ -int +static int screen_redraw_make_pane_status(struct client *c, struct window *w, struct window_pane *wp) { @@ -303,7 +305,7 @@ screen_redraw_make_pane_status(struct client *c, struct window *w, } /* Draw pane status. */ -void +static void screen_redraw_draw_pane_status(struct client *c, int pane_status) { struct window *w = c->session->curw->window; @@ -418,7 +420,7 @@ screen_redraw_pane(struct client *c, struct window_pane *wp) } /* Draw the borders. */ -void +static void screen_redraw_draw_borders(struct client *c, int status, int pane_status, u_int top) { @@ -505,7 +507,7 @@ screen_redraw_draw_borders(struct client *c, int status, int pane_status, } /* Draw the panes. */ -void +static void screen_redraw_draw_panes(struct client *c, u_int top) { struct window *w = c->session->curw->window; @@ -524,7 +526,7 @@ screen_redraw_draw_panes(struct client *c, u_int top) } /* Draw the status line. */ -void +static void screen_redraw_draw_status(struct client *c, u_int top) { struct tty *tty = &c->tty; @@ -536,7 +538,7 @@ screen_redraw_draw_status(struct client *c, u_int top) } /* Draw number on a pane. */ -void +static void screen_redraw_draw_number(struct client *c, struct window_pane *wp, u_int top) { struct tty *tty = &c->tty; diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c index 429aeaa8476..febe5795166 100644 --- a/usr.bin/tmux/screen.c +++ b/usr.bin/tmux/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.40 2016/09/02 20:57:20 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.41 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -24,8 +24,8 @@ #include "tmux.h" -void screen_resize_x(struct screen *, u_int); -void screen_resize_y(struct screen *, u_int); +static void screen_resize_x(struct screen *, u_int); +static void screen_resize_y(struct screen *, u_int); /* Create a new screen. */ void @@ -139,7 +139,7 @@ screen_resize(struct screen *s, u_int sx, u_int sy, int reflow) screen_reflow(s, sx); } -void +static void screen_resize_x(struct screen *s, u_int sx) { struct grid *gd = s->grid; @@ -161,7 +161,7 @@ screen_resize_x(struct screen *s, u_int sx) gd->sx = sx; } -void +static void screen_resize_y(struct screen *s, u_int sy) { struct grid *gd = s->grid; @@ -221,8 +221,8 @@ screen_resize_y(struct screen *s, u_int sy) needed = sy - oldy; /* - * Try to pull as much as possible out of scrolled history, if is - * is enabled. + * Try to pull as much as possible out of scrolled history, if + * is is enabled. */ available = gd->hscrolled; if (gd->flags & GRID_HISTORY && available > 0) { diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 4fdeb9ce388..4027c0a9474 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.189 2016/10/09 16:24:34 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.190 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -32,21 +32,21 @@ #include "tmux.h" -void server_client_free(int, short, void *); -void server_client_check_focus(struct window_pane *); -void server_client_check_resize(struct window_pane *); -key_code server_client_check_mouse(struct client *); -void server_client_repeat_timer(int, short, void *); -void server_client_check_exit(struct client *); -void server_client_check_redraw(struct client *); -void server_client_set_title(struct client *); -void server_client_reset_state(struct client *); -int server_client_assume_paste(struct session *); - -void server_client_dispatch(struct imsg *, void *); -void server_client_dispatch_command(struct client *, struct imsg *); -void server_client_dispatch_identify(struct client *, struct imsg *); -void server_client_dispatch_shell(struct client *); +static void server_client_free(int, short, void *); +static void server_client_check_focus(struct window_pane *); +static void server_client_check_resize(struct window_pane *); +static key_code server_client_check_mouse(struct client *); +static void server_client_repeat_timer(int, short, void *); +static void server_client_check_exit(struct client *); +static void server_client_check_redraw(struct client *); +static void server_client_set_title(struct client *); +static void server_client_reset_state(struct client *); +static int server_client_assume_paste(struct session *); + +static void server_client_dispatch(struct imsg *, void *); +static void server_client_dispatch_command(struct client *, struct imsg *); +static void server_client_dispatch_identify(struct client *, struct imsg *); +static void server_client_dispatch_shell(struct client *); /* Check if this client is inside this server. */ int @@ -264,7 +264,7 @@ server_client_unref(struct client *c) } /* Free dead client. */ -void +static void server_client_free(__unused int fd, __unused short events, void *arg) { struct client *c = arg; @@ -289,7 +289,7 @@ server_client_detach(struct client *c, enum msgtype msgtype) } /* Check for mouse keys. */ -key_code +static key_code server_client_check_mouse(struct client *c) { struct session *s = c->session; @@ -555,7 +555,7 @@ server_client_check_mouse(struct client *c) } /* Is this fast enough to probably be a paste? */ -int +static int server_client_assume_paste(struct session *s) { struct timeval tv; @@ -787,7 +787,7 @@ server_client_resize_event(__unused int fd, __unused short events, void *data) } /* Check if pane should be resized. */ -void +static void server_client_check_resize(struct window_pane *wp) { struct timeval tv = { .tv_usec = 250000 }; @@ -817,7 +817,7 @@ server_client_check_resize(struct window_pane *wp) } /* Check whether pane should be focused. */ -void +static void server_client_check_focus(struct window_pane *wp) { struct client *c; @@ -878,7 +878,7 @@ focused: * tty_region/tty_reset/tty_update_mode already take care of not resetting * things that are already in their default state. */ -void +static void server_client_reset_state(struct client *c) { struct window *w = c->session->curw->window; @@ -914,7 +914,7 @@ server_client_reset_state(struct client *c) } /* Repeat time callback. */ -void +static void server_client_repeat_timer(__unused int fd, __unused short events, void *data) { struct client *c = data; @@ -927,7 +927,7 @@ server_client_repeat_timer(__unused int fd, __unused short events, void *data) } /* Check if client should be exited. */ -void +static void server_client_check_exit(struct client *c) { if (!(c->flags & CLIENT_EXIT)) @@ -945,7 +945,7 @@ server_client_check_exit(struct client *c) } /* Check for client redraws. */ -void +static void server_client_check_redraw(struct client *c) { struct session *s = c->session; @@ -1001,7 +1001,7 @@ server_client_check_redraw(struct client *c) } /* Set client title. */ -void +static void server_client_set_title(struct client *c) { struct session *s = c->session; @@ -1026,7 +1026,7 @@ server_client_set_title(struct client *c) } /* Dispatch message from client. */ -void +static void server_client_dispatch(struct imsg *imsg, void *arg) { struct client *c = arg; @@ -1130,7 +1130,7 @@ server_client_dispatch(struct imsg *imsg, void *arg) } /* Handle command message. */ -void +static void server_client_dispatch_command(struct client *c, struct imsg *imsg) { struct msg_command_data data; @@ -1183,7 +1183,7 @@ error: } /* Handle identify message. */ -void +static void server_client_dispatch_identify(struct client *c, struct imsg *imsg) { const char *data, *home; @@ -1291,7 +1291,7 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg) } /* Handle shell message. */ -void +static void server_client_dispatch_shell(struct client *c) { const char *shell; diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c index 58b3bbd655a..60d088dc37e 100644 --- a/usr.bin/tmux/server-fn.c +++ b/usr.bin/tmux/server-fn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-fn.c,v 1.99 2016/06/16 10:55:47 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.100 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -28,8 +28,8 @@ #include "tmux.h" -struct session *server_next_session(struct session *); -void server_callback_identify(int, short, void *); +static struct session *server_next_session(struct session *); +static void server_callback_identify(int, short, void *); void server_fill_environ(struct session *s, struct environ *env) @@ -355,7 +355,7 @@ server_destroy_session_group(struct session *s) } } -struct session * +static struct session * server_next_session(struct session *s) { struct session *s_loop, *s_out; @@ -454,7 +454,7 @@ server_clear_identify(struct client *c, struct window_pane *wp) server_redraw_client(c); } -void +static void server_callback_identify(__unused int fd, __unused short events, void *data) { server_clear_identify(data, NULL); diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index 420f1644600..4c5b75cdf25 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.159 2016/07/07 09:24:09 semarie Exp $ */ +/* $OpenBSD: server.c,v 1.160 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -44,21 +44,20 @@ struct clients clients; struct tmuxproc *server_proc; -int server_fd; -int server_exit; -struct event server_ev_accept; +static int server_fd; +static int server_exit; +static struct event server_ev_accept; struct cmd_find_state marked_pane; -int server_create_socket(void); -int server_loop(void); -int server_should_exit(void); -void server_send_exit(void); -void server_accept(int, short, void *); -void server_signal(int); -void server_child_signal(void); -void server_child_exited(pid_t, int); -void server_child_stopped(pid_t, int); +static int server_create_socket(void); +static int server_loop(void); +static void server_send_exit(void); +static void server_accept(int, short, void *); +static void server_signal(int); +static void server_child_signal(void); +static void server_child_exited(pid_t, int); +static void server_child_stopped(pid_t, int); /* Set marked pane. */ void @@ -99,7 +98,7 @@ server_check_marked(void) } /* Create server socket. */ -int +static int server_create_socket(void) { struct sockaddr_un sa; @@ -187,7 +186,7 @@ server_start(struct event_base *base, int lockfd, char *lockfile) } /* Server loop callback. */ -int +static int server_loop(void) { struct client *c; @@ -216,7 +215,7 @@ server_loop(void) } /* Exit the server by killing all clients and windows. */ -void +static void server_send_exit(void) { struct client *c, *c1; @@ -273,7 +272,7 @@ server_update_socket(void) } /* Callback for server socket. */ -void +static void server_accept(int fd, short events, __unused void *data) { struct sockaddr_storage sa; @@ -326,7 +325,7 @@ server_add_accept(int timeout) } /* Signal handler. */ -void +static void server_signal(int sig) { int fd; @@ -353,7 +352,7 @@ server_signal(int sig) } /* Handle SIGCHLD. */ -void +static void server_child_signal(void) { int status; @@ -376,7 +375,7 @@ server_child_signal(void) } /* Handle exited children. */ -void +static void server_child_exited(pid_t pid, int status) { struct window *w, *w1; @@ -402,7 +401,7 @@ server_child_exited(pid_t pid, int status) } /* Handle stopped children. */ -void +static void server_child_stopped(pid_t pid, int status) { struct window *w; diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c index f8babefd35d..98813bdc357 100644 --- a/usr.bin/tmux/session.c +++ b/usr.bin/tmux/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.62 2016/01/19 15:59:12 nicm Exp $ */ +/* $OpenBSD: session.c,v 1.63 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -27,16 +27,16 @@ #include "tmux.h" -struct sessions sessions; -u_int next_session_id; -struct session_groups session_groups; +struct sessions sessions; +static u_int next_session_id; +struct session_groups session_groups; -void session_free(int, short, void *); +static void session_free(int, short, void *); -void session_lock_timer(int, short, void *); +static void session_lock_timer(int, short, void *); -struct winlink *session_next_alert(struct winlink *); -struct winlink *session_previous_alert(struct winlink *); +static struct winlink *session_next_alert(struct winlink *); +static struct winlink *session_previous_alert(struct winlink *); RB_GENERATE(sessions, session, entry, session_cmp); @@ -182,7 +182,7 @@ session_unref(struct session *s) } /* Free session. */ -void +static void session_free(__unused int fd, __unused short events, void *arg) { struct session *s = arg; @@ -239,7 +239,7 @@ session_check_name(const char *name) } /* Lock session if it has timed out. */ -void +static void session_lock_timer(__unused int fd, __unused short events, void *arg) { struct session *s = arg; @@ -426,7 +426,7 @@ session_is_linked(struct session *s, struct window *w) return (w->references != 1); } -struct winlink * +static struct winlink * session_next_alert(struct winlink *wl) { while (wl != NULL) { @@ -457,7 +457,7 @@ session_next(struct session *s, int alert) return (session_set_current(s, wl)); } -struct winlink * +static struct winlink * session_previous_alert(struct winlink *wl) { while (wl != NULL) { diff --git a/usr.bin/tmux/signal.c b/usr.bin/tmux/signal.c index 4a3840de82b..a2b79c225ce 100644 --- a/usr.bin/tmux/signal.c +++ b/usr.bin/tmux/signal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.c,v 1.9 2016/01/19 15:59:12 nicm Exp $ */ +/* $OpenBSD: signal.c,v 1.10 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -24,12 +24,12 @@ #include "tmux.h" -struct event ev_sighup; -struct event ev_sigchld; -struct event ev_sigcont; -struct event ev_sigterm; -struct event ev_sigusr1; -struct event ev_sigwinch; +static struct event ev_sighup; +static struct event ev_sigchld; +static struct event ev_sigcont; +static struct event ev_sigterm; +static struct event ev_sigusr1; +static struct event ev_sigwinch; void set_signals(void (*handler)(int, short, void *), void *arg) diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index c14011ef492..84ebf5bfe53 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.150 2016/09/12 15:40:58 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.151 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -29,33 +29,33 @@ #include "tmux.h" -char *status_redraw_get_left(struct client *, time_t, struct grid_cell *, - size_t *); -char *status_redraw_get_right(struct client *, time_t, struct grid_cell *, - size_t *); -char *status_print(struct client *, struct winlink *, time_t, - struct grid_cell *); -char *status_replace(struct client *, struct winlink *, const char *, time_t); -void status_message_callback(int, short, void *); -void status_timer_callback(int, short, void *); - -const char *status_prompt_up_history(u_int *); -const char *status_prompt_down_history(u_int *); -void status_prompt_add_history(const char *); - -const char **status_prompt_complete_list(u_int *, const char *); -char *status_prompt_complete_prefix(const char **, u_int); -char *status_prompt_complete(struct session *, const char *); - -char *status_prompt_find_history_file(void); +static char *status_redraw_get_left(struct client *, time_t, + struct grid_cell *, size_t *); +static char *status_redraw_get_right(struct client *, time_t, + struct grid_cell *, size_t *); +static char *status_print(struct client *, struct winlink *, time_t, + struct grid_cell *); +static char *status_replace(struct client *, struct winlink *, const char *, + time_t); +static void status_message_callback(int, short, void *); +static void status_timer_callback(int, short, void *); + +static char *status_prompt_find_history_file(void); +static const char *status_prompt_up_history(u_int *); +static const char *status_prompt_down_history(u_int *); +static void status_prompt_add_history(const char *); + +static const char **status_prompt_complete_list(u_int *, const char *); +static char *status_prompt_complete_prefix(const char **, u_int); +static char *status_prompt_complete(struct session *, const char *); /* Status prompt history. */ #define PROMPT_HISTORY 100 -char **status_prompt_hlist; -u_int status_prompt_hsize; +static char **status_prompt_hlist; +static u_int status_prompt_hsize; /* Find the history file to load/save from/to. */ -char * +static char * status_prompt_find_history_file(void) { const char *home, *history_file; @@ -144,7 +144,7 @@ status_prompt_save_history(void) } /* Status timer callback. */ -void +static void status_timer_callback(__unused int fd, __unused short events, void *arg) { struct client *c = arg; @@ -207,7 +207,7 @@ status_at_line(struct client *c) } /* Retrieve options for left string. */ -char * +static char * status_redraw_get_left(struct client *c, time_t t, struct grid_cell *gc, size_t *size) { @@ -229,7 +229,7 @@ status_redraw_get_left(struct client *c, time_t t, struct grid_cell *gc, } /* Retrieve options for right string. */ -char * +static char * status_redraw_get_right(struct client *c, time_t t, struct grid_cell *gc, size_t *size) { @@ -493,7 +493,7 @@ out: } /* Replace special sequences in fmt. */ -char * +static char * status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t) { struct format_tree *ft; @@ -515,7 +515,7 @@ status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t) } /* Return winlink status line entry and adjust gc as necessary. */ -char * +static char * status_print(struct client *c, struct winlink *wl, time_t t, struct grid_cell *gc) { @@ -607,7 +607,7 @@ status_message_clear(struct client *c) } /* Clear status line message after timer expires. */ -void +static void status_message_callback(__unused int fd, __unused short event, void *data) { struct client *c = data; @@ -1139,7 +1139,7 @@ status_prompt_key(struct client *c, key_code key) } /* Get previous line from the history. */ -const char * +static const char * status_prompt_up_history(u_int *idx) { /* @@ -1154,7 +1154,7 @@ status_prompt_up_history(u_int *idx) } /* Get next line from the history. */ -const char * +static const char * status_prompt_down_history(u_int *idx) { if (status_prompt_hsize == 0 || *idx == 0) @@ -1166,7 +1166,7 @@ status_prompt_down_history(u_int *idx) } /* Add line to the history. */ -void +static void status_prompt_add_history(const char *line) { size_t size; @@ -1191,7 +1191,7 @@ status_prompt_add_history(const char *line) } /* Build completion list. */ -const char ** +static const char ** status_prompt_complete_list(u_int *size, const char *s) { const char **list = NULL, **layout; @@ -1225,7 +1225,7 @@ status_prompt_complete_list(u_int *size, const char *s) } /* Find longest prefix. */ -char * +static char * status_prompt_complete_prefix(const char **list, u_int size) { char *out; @@ -1246,7 +1246,7 @@ status_prompt_complete_prefix(const char **list, u_int size) } /* Complete word. */ -char * +static char * status_prompt_complete(struct session *sess, const char *s) { const char **list = NULL, *colon; diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 6602cf08734..107a961aebd 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.170 2016/05/27 17:05:42 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.171 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -44,10 +44,10 @@ struct hooks *global_hooks; struct timeval start_time; const char *socket_path; -__dead void usage(void); -static char *make_label(const char *); +static __dead void usage(void); +static char *make_label(const char *); -__dead void +static __dead void usage(void) { fprintf(stderr, diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c index a86cebf2d3e..896f36cbe95 100644 --- a/usr.bin/tmux/tty-keys.c +++ b/usr.bin/tmux/tty-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.89 2016/04/29 10:42:16 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.90 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -50,7 +50,7 @@ struct tty_default_key_raw { const char *string; key_code key; }; -const struct tty_default_key_raw tty_default_raw_keys[] = { +static const struct tty_default_key_raw tty_default_raw_keys[] = { /* * Numeric keypad. Just use the vt100 escape sequences here and always * put the terminal into keypad_xmit mode. Translation of numbers @@ -170,7 +170,7 @@ struct tty_default_key_code { enum tty_code_code code; key_code key; }; -const struct tty_default_key_code tty_default_code_keys[] = { +static const struct tty_default_key_code tty_default_code_keys[] = { /* Function keys. */ { TTYC_KF1, KEYC_F1 }, { TTYC_KF2, KEYC_F2 }, diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c index 0aa9799041f..dab12ab4be2 100644 --- a/usr.bin/tmux/tty-term.c +++ b/usr.bin/tmux/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.45 2016/01/29 11:13:56 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.46 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -27,8 +27,8 @@ #include "tmux.h" -void tty_term_override(struct tty_term *, const char *); -char *tty_term_strip(const char *); +static void tty_term_override(struct tty_term *, const char *); +static char *tty_term_strip(const char *); struct tty_terms tty_terms = LIST_HEAD_INITIALIZER(tty_terms); @@ -53,7 +53,7 @@ struct tty_term_code_entry { const char *name; }; -const struct tty_term_code_entry tty_term_codes[] = { +static const struct tty_term_code_entry tty_term_codes[] = { [TTYC_ACSC] = { TTYCODE_STRING, "acsc" }, [TTYC_AX] = { TTYCODE_FLAG, "AX" }, [TTYC_BCE] = { TTYCODE_FLAG, "bce" }, @@ -264,7 +264,7 @@ tty_term_ncodes(void) return (nitems(tty_term_codes)); } -char * +static char * tty_term_strip(const char *s) { const char *ptr; @@ -293,7 +293,7 @@ tty_term_strip(const char *s) return (xstrdup(buf)); } -void +static void tty_term_override(struct tty_term *term, const char *overrides) { const struct tty_term_code_entry *ent; diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 9514578fbeb..c0d45813ac1 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.206 2016/10/03 19:19:18 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.207 2016/10/10 21:29:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -31,31 +31,32 @@ #include "tmux.h" -static int tty_log_fd = -1; +static int tty_log_fd = -1; -void tty_read_callback(struct bufferevent *, void *); -void tty_error_callback(struct bufferevent *, short, void *); +static void tty_read_callback(struct bufferevent *, void *); +static void tty_error_callback(struct bufferevent *, short, void *); -static int tty_client_ready(struct client *, struct window_pane *); +static int tty_client_ready(struct client *, struct window_pane *); -void tty_set_italics(struct tty *); -int tty_try_colour(struct tty *, int, const char *); +static void tty_set_italics(struct tty *); +static int tty_try_colour(struct tty *, int, const char *); -void tty_colours(struct tty *, const struct grid_cell *); -void tty_check_fg(struct tty *, struct grid_cell *); -void tty_check_bg(struct tty *, struct grid_cell *); -void tty_colours_fg(struct tty *, const struct grid_cell *); -void tty_colours_bg(struct tty *, const struct grid_cell *); +static void tty_colours(struct tty *, const struct grid_cell *); +static void tty_check_fg(struct tty *, struct grid_cell *); +static void tty_check_bg(struct tty *, struct grid_cell *); +static void tty_colours_fg(struct tty *, const struct grid_cell *); +static void tty_colours_bg(struct tty *, const struct grid_cell *); -int tty_large_region(struct tty *, const struct tty_ctx *); -int tty_fake_bce(const struct tty *, const struct window_pane *); -void tty_redraw_region(struct tty *, const struct tty_ctx *); -void tty_emulate_repeat(struct tty *, enum tty_code_code, enum tty_code_code, - u_int); -void tty_repeat_space(struct tty *, u_int); -void tty_cell(struct tty *, const struct grid_cell *, - const struct window_pane *); -void tty_default_colours(struct grid_cell *, const struct window_pane *); +static int tty_large_region(struct tty *, const struct tty_ctx *); +static int tty_fake_bce(const struct tty *, const struct window_pane *); +static void tty_redraw_region(struct tty *, const struct tty_ctx *); +static void tty_emulate_repeat(struct tty *, enum tty_code_code, + enum tty_code_code, u_int); +static void tty_repeat_space(struct tty *, u_int); +static void tty_cell(struct tty *, const struct grid_cell *, + const struct window_pane *); +static void tty_default_colours(struct grid_cell *, + const struct window_pane *); #define tty_use_acs(tty) \ (tty_term_has((tty)->term, TTYC_ACSC) && !((tty)->flags & TTY_UTF8)) @@ -173,7 +174,7 @@ tty_open(struct tty *tty, char **cause) return (0); } -void +static void tty_read_callback(__unused struct bufferevent *bufev, void *data) { struct tty *tty = data; @@ -182,7 +183,7 @@ tty_read_callback(__unused struct bufferevent *bufev, void *data) ; } -void +static void tty_error_callback(__unused struct bufferevent *bufev, __unused short what, __unused void *data) { @@ -450,7 +451,7 @@ tty_putn(struct tty *tty, const void *buf, size_t len, u_int width) tty->cx += width; } -void +static void tty_set_italics(struct tty *tty) { const char *s; @@ -559,7 +560,7 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s) tty->mode = mode; } -void +static void tty_emulate_repeat(struct tty *tty, enum tty_code_code code, enum tty_code_code code1, u_int n) { @@ -571,7 +572,7 @@ tty_emulate_repeat(struct tty *tty, enum tty_code_code code, } } -void +static void tty_repeat_space(struct tty *tty, u_int n) { while (n-- > 0) @@ -583,7 +584,7 @@ tty_repeat_space(struct tty *tty, u_int n) * probably several times now? Currently yes if it is more than 50% of the * pane. */ -int +static int tty_large_region(__unused struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; @@ -595,7 +596,7 @@ tty_large_region(__unused struct tty *tty, const struct tty_ctx *ctx) * Return if BCE is needed but the terminal doesn't have it - it'll need to be * emulated. */ -int +static int tty_fake_bce(const struct tty *tty, const struct window_pane *wp) { struct grid_cell gc; @@ -614,7 +615,7 @@ tty_fake_bce(const struct tty *tty, const struct window_pane *wp) * CSR not supported, or window is a pane that doesn't take up the full * width of the terminal. */ -void +static void tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; @@ -1129,7 +1130,7 @@ tty_cmd_rawstring(struct tty *tty, const struct tty_ctx *ctx) tty_cursor(tty, 0, 0); } -void +static void tty_cell(struct tty *tty, const struct grid_cell *gc, const struct window_pane *wp) { @@ -1419,7 +1420,7 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc, tty_putcode(tty, TTYC_SMACS); } -void +static void tty_colours(struct tty *tty, const struct grid_cell *gc) { struct grid_cell *tc = &tty->cell; @@ -1559,7 +1560,7 @@ tty_check_bg(struct tty *tty, struct grid_cell *gc) gc->bg -= 90; } -void +static void tty_colours_fg(struct tty *tty, const struct grid_cell *gc) { struct grid_cell *tc = &tty->cell; @@ -1589,7 +1590,7 @@ save_fg: tc->fg = gc->fg; } -void +static void tty_colours_bg(struct tty *tty, const struct grid_cell *gc) { struct grid_cell *tc = &tty->cell; @@ -1619,7 +1620,7 @@ save_bg: tc->bg = gc->bg; } -int +static int tty_try_colour(struct tty *tty, int colour, const char *type) { u_char r, g, b; @@ -1672,7 +1673,7 @@ fallback_256: return (0); } -void +static void tty_default_colours(struct grid_cell *gc, const struct window_pane *wp) { struct window *w = wp->window; |