diff options
author | nicm <nicm> | 2016-10-10 21:29:23 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-10-10 21:29:23 +0000 |
commit | c426e485e527a03aa3b4bdbb3203f621e006cbd5 (patch) | |
tree | 2f0add91706d06d7cf4d748294805c8d4d4d8d39 | |
parent | 66b5477cc1909e57489f854939a524ce2cd0f479 (diff) |
Loads more static, except for cmd-*.c and window-*.c.
-rw-r--r-- | cfg.c | 4 | ||||
-rw-r--r-- | environ.c | 7 | ||||
-rw-r--r-- | format.c | 123 | ||||
-rw-r--r-- | grid.c | 35 | ||||
-rw-r--r-- | hooks.c | 3 | ||||
-rw-r--r-- | job.c | 8 | ||||
-rw-r--r-- | key-string.c | 2 | ||||
-rw-r--r-- | layout-set.c | 18 | ||||
-rw-r--r-- | mode-key.c | 18 | ||||
-rw-r--r-- | names.c | 8 | ||||
-rw-r--r-- | notify.c | 15 | ||||
-rw-r--r-- | options.c | 3 | ||||
-rw-r--r-- | procname.c | 6 | ||||
-rw-r--r-- | screen-redraw.c | 54 | ||||
-rw-r--r-- | screen.c | 12 | ||||
-rw-r--r-- | server-client.c | 58 | ||||
-rw-r--r-- | server-fn.c | 8 | ||||
-rw-r--r-- | server.c | 39 | ||||
-rw-r--r-- | session.c | 22 | ||||
-rw-r--r-- | signal.c | 12 | ||||
-rw-r--r-- | status.c | 68 | ||||
-rw-r--r-- | tmux.c | 6 | ||||
-rw-r--r-- | tty-keys.c | 4 | ||||
-rw-r--r-- | tty-term.c | 10 | ||||
-rw-r--r-- | tty.c | 69 |
25 files changed, 309 insertions, 303 deletions
@@ -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) @@ -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)); @@ -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) { @@ -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; @@ -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 *); @@ -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/key-string.c b/key-string.c index ef5cf17c..00ebb386 100644 --- a/key-string.c +++ b/key-string.c @@ -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/layout-set.c b/layout-set.c index 4d2b8ca7..1da7037a 100644 --- a/layout-set.c +++ b/layout-set.c @@ -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; @@ -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 }, @@ -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; @@ -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; @@ -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 *); @@ -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/screen-redraw.c b/screen-redraw.c index 5e4b0848..00e94d61 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -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 *); - -int screen_redraw_make_pane_status(struct client *, struct window *, - struct window_pane *); -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 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 *); + +static int screen_redraw_make_pane_status(struct client *, struct window *, + struct window_pane *); +static void screen_redraw_draw_pane_status(struct client *, 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 |