Loads more static, except for cmd-*.c and window-*.c.

This commit is contained in:
nicm
2016-10-10 21:29:23 +00:00
parent 66b5477cc1
commit c426e485e5
25 changed files with 301 additions and 295 deletions

4
cfg.c
View File

@@ -36,7 +36,7 @@ char **cfg_causes;
u_int cfg_ncauses; u_int cfg_ncauses;
struct client *cfg_client; struct client *cfg_client;
void cfg_default_done(struct cmd_q *); static void cfg_default_done(struct cmd_q *);
void void
set_cfg_file(const char *path) set_cfg_file(const char *path)
@@ -126,7 +126,7 @@ load_cfg(const char *path, struct cmd_q *cmdq, int quiet)
return (found); return (found);
} }
void static void
cfg_default_done(__unused struct cmd_q *cmdq) cfg_default_done(__unused struct cmd_q *cmdq)
{ {
if (--cfg_references != 0) if (--cfg_references != 0)

View File

@@ -28,11 +28,10 @@
*/ */
RB_HEAD(environ, environ_entry); RB_HEAD(environ, environ_entry);
int environ_cmp(struct environ_entry *, struct environ_entry *); static int environ_cmp(struct environ_entry *, struct environ_entry *);
RB_PROTOTYPE(environ, environ_entry, entry, environ_cmp); RB_GENERATE_STATIC(environ, environ_entry, entry, environ_cmp);
RB_GENERATE(environ, environ_entry, entry, environ_cmp);
int static int
environ_cmp(struct environ_entry *envent1, struct environ_entry *envent2) environ_cmp(struct environ_entry *envent1, struct environ_entry *envent2)
{ {
return (strcmp(envent1->name, envent2->name)); return (strcmp(envent1->name, envent2->name));

117
format.c
View File

@@ -39,34 +39,41 @@
struct format_entry; struct format_entry;
typedef void (*format_cb)(struct format_tree *, struct format_entry *); typedef void (*format_cb)(struct format_tree *, struct format_entry *);
void format_job_callback(struct job *); static void format_job_callback(struct job *);
char *format_job_get(struct format_tree *, const char *); static char *format_job_get(struct format_tree *, const char *);
void format_job_timer(int, short, void *); static void format_job_timer(int, short, void *);
void format_cb_host(struct format_tree *, struct format_entry *); static void format_cb_host(struct format_tree *, struct format_entry *);
void format_cb_host_short(struct format_tree *, struct format_entry *); static void format_cb_host_short(struct format_tree *,
void format_cb_pid(struct format_tree *, struct format_entry *); struct format_entry *);
void format_cb_session_alerts(struct format_tree *, struct format_entry *); static void format_cb_pid(struct format_tree *, struct format_entry *);
void format_cb_window_layout(struct format_tree *, struct format_entry *); static void format_cb_session_alerts(struct format_tree *,
void format_cb_window_visible_layout(struct format_tree *, struct format_entry *);
struct format_entry *); static void format_cb_window_layout(struct format_tree *,
void format_cb_start_command(struct format_tree *, struct format_entry *); struct format_entry *);
void format_cb_current_command(struct format_tree *, struct format_entry *); static void format_cb_window_visible_layout(struct format_tree *,
void format_cb_history_bytes(struct format_tree *, struct format_entry *); struct format_entry *);
void format_cb_pane_tabs(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 *);
char *format_find(struct format_tree *, const char *, int); static char *format_find(struct format_tree *, const char *, int);
void format_add_cb(struct format_tree *, const char *, format_cb); static void format_add_cb(struct format_tree *, const char *, format_cb);
void format_add_tv(struct format_tree *, const char *, struct timeval *); static void format_add_tv(struct format_tree *, const char *,
int format_replace(struct format_tree *, const char *, size_t, char **, struct timeval *);
size_t *, size_t *); static int format_replace(struct format_tree *, const char *, size_t,
char *format_time_string(time_t); char **, size_t *, size_t *);
void format_defaults_pane_tabs(struct format_tree *, struct window_pane *); static void format_defaults_session(struct format_tree *,
void format_defaults_session(struct format_tree *, struct session *); struct session *);
void format_defaults_client(struct format_tree *, struct client *); static void format_defaults_client(struct format_tree *, struct client *);
void format_defaults_winlink(struct format_tree *, struct session *, static void format_defaults_winlink(struct format_tree *, struct session *,
struct winlink *); struct winlink *);
/* Entry in format job tree. */ /* Entry in format job tree. */
struct format_job { struct format_job {
@@ -82,14 +89,13 @@ struct format_job {
}; };
/* Format job tree. */ /* Format job tree. */
struct event format_job_event; static struct event format_job_event;
int format_job_cmp(struct format_job *, struct format_job *); static int format_job_cmp(struct format_job *, struct format_job *);
RB_HEAD(format_job_tree, format_job) format_jobs = RB_INITIALIZER(); RB_HEAD(format_job_tree, format_job) format_jobs = RB_INITIALIZER();
RB_PROTOTYPE(format_job_tree, format_job, entry, format_job_cmp); RB_GENERATE_STATIC(format_job_tree, format_job, entry, format_job_cmp);
RB_GENERATE(format_job_tree, format_job, entry, format_job_cmp);
/* Format job tree comparison function. */ /* Format job tree comparison function. */
int static int
format_job_cmp(struct format_job *fj1, struct format_job *fj2) format_job_cmp(struct format_job *fj1, struct format_job *fj2)
{ {
return (strcmp(fj1->cmd, fj2->cmd)); return (strcmp(fj1->cmd, fj2->cmd));
@@ -120,19 +126,18 @@ struct format_tree {
RB_HEAD(format_entry_tree, format_entry) tree; RB_HEAD(format_entry_tree, format_entry) tree;
}; };
int format_entry_cmp(struct format_entry *, struct format_entry *); static int format_entry_cmp(struct format_entry *, struct format_entry *);
RB_PROTOTYPE(format_entry_tree, format_entry, entry, format_entry_cmp); RB_GENERATE_STATIC(format_entry_tree, format_entry, entry, format_entry_cmp);
RB_GENERATE(format_entry_tree, format_entry, entry, format_entry_cmp);
/* Format entry tree comparison function. */ /* Format entry tree comparison function. */
int static int
format_entry_cmp(struct format_entry *fe1, struct format_entry *fe2) format_entry_cmp(struct format_entry *fe1, struct format_entry *fe2)
{ {
return (strcmp(fe1->key, fe2->key)); return (strcmp(fe1->key, fe2->key));
} }
/* Single-character uppercase aliases. */ /* Single-character uppercase aliases. */
const char *format_upper[] = { static const char *format_upper[] = {
NULL, /* A */ NULL, /* A */
NULL, /* B */ NULL, /* B */
NULL, /* C */ NULL, /* C */
@@ -162,7 +167,7 @@ const char *format_upper[] = {
}; };
/* Single-character lowercase aliases. */ /* Single-character lowercase aliases. */
const char *format_lower[] = { static const char *format_lower[] = {
NULL, /* a */ NULL, /* a */
NULL, /* b */ NULL, /* b */
NULL, /* c */ NULL, /* c */
@@ -192,7 +197,7 @@ const char *format_lower[] = {
}; };
/* Format job callback. */ /* Format job callback. */
void static void
format_job_callback(struct job *job) format_job_callback(struct job *job)
{ {
struct format_job *fj = job->data; struct format_job *fj = job->data;
@@ -224,7 +229,7 @@ format_job_callback(struct job *job)
} }
/* Find a job. */ /* Find a job. */
char * static char *
format_job_get(struct format_tree *ft, const char *cmd) format_job_get(struct format_tree *ft, const char *cmd)
{ {
struct format_job fj0, *fj; struct format_job fj0, *fj;
@@ -258,7 +263,7 @@ format_job_get(struct format_tree *ft, const char *cmd)
} }
/* Remove old jobs. */ /* Remove old jobs. */
void static void
format_job_timer(__unused int fd, __unused short events, __unused void *arg) format_job_timer(__unused int fd, __unused short events, __unused void *arg)
{ {
struct format_job *fj, *fj1; struct format_job *fj, *fj1;
@@ -287,7 +292,7 @@ format_job_timer(__unused int fd, __unused short events, __unused void *arg)
} }
/* Callback for host. */ /* Callback for host. */
void static void
format_cb_host(__unused struct format_tree *ft, struct format_entry *fe) format_cb_host(__unused struct format_tree *ft, struct format_entry *fe)
{ {
char host[HOST_NAME_MAX + 1]; 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. */ /* Callback for host_short. */
void static void
format_cb_host_short(__unused struct format_tree *ft, struct format_entry *fe) format_cb_host_short(__unused struct format_tree *ft, struct format_entry *fe)
{ {
char host[HOST_NAME_MAX + 1], *cp; 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. */ /* Callback for pid. */
void static void
format_cb_pid(__unused struct format_tree *ft, struct format_entry *fe) format_cb_pid(__unused struct format_tree *ft, struct format_entry *fe)
{ {
xasprintf(&fe->value, "%ld", (long)getpid()); xasprintf(&fe->value, "%ld", (long)getpid());
} }
/* Callback for session_alerts. */ /* Callback for session_alerts. */
void static void
format_cb_session_alerts(struct format_tree *ft, struct format_entry *fe) format_cb_session_alerts(struct format_tree *ft, struct format_entry *fe)
{ {
struct session *s = ft->s; 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. */ /* Callback for window_layout. */
void static void
format_cb_window_layout(struct format_tree *ft, struct format_entry *fe) format_cb_window_layout(struct format_tree *ft, struct format_entry *fe)
{ {
struct window *w = ft->w; 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. */ /* Callback for window_visible_layout. */
void static void
format_cb_window_visible_layout(struct format_tree *ft, struct format_entry *fe) format_cb_window_visible_layout(struct format_tree *ft, struct format_entry *fe)
{ {
struct window *w = ft->w; 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. */ /* Callback for pane_start_command. */
void static void
format_cb_start_command(struct format_tree *ft, struct format_entry *fe) format_cb_start_command(struct format_tree *ft, struct format_entry *fe)
{ {
struct window_pane *wp = ft->wp; 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. */ /* Callback for pane_current_command. */
void static void
format_cb_current_command(struct format_tree *ft, struct format_entry *fe) format_cb_current_command(struct format_tree *ft, struct format_entry *fe)
{ {
struct window_pane *wp = ft->wp; 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. */ /* Callback for history_bytes. */
void static void
format_cb_history_bytes(struct format_tree *ft, struct format_entry *fe) format_cb_history_bytes(struct format_tree *ft, struct format_entry *fe)
{ {
struct window_pane *wp = ft->wp; 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. */ /* Callback for pane_tabs. */
void static void
format_cb_pane_tabs(struct format_tree *ft, struct format_entry *fe) format_cb_pane_tabs(struct format_tree *ft, struct format_entry *fe)
{ {
struct window_pane *wp = ft->wp; 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. */ /* Add a key and time. */
void static void
format_add_tv(struct format_tree *ft, const char *key, struct timeval *tv) format_add_tv(struct format_tree *ft, const char *key, struct timeval *tv)
{ {
struct format_entry *fe; 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. */ /* Add a key and function. */
void static void
format_add_cb(struct format_tree *ft, const char *key, format_cb cb) format_add_cb(struct format_tree *ft, const char *key, format_cb cb)
{ {
struct format_entry *fe; 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. */ /* Find a format entry. */
char * static char *
format_find(struct format_tree *ft, const char *key, int modifiers) format_find(struct format_tree *ft, const char *key, int modifiers)
{ {
struct format_entry *fe, fe_find; struct format_entry *fe, fe_find;
@@ -682,7 +687,7 @@ found:
* Replace a key/value pair in buffer. #{blah} is expanded directly, * 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. * #{?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, format_replace(struct format_tree *ft, const char *key, size_t keylen,
char **buf, size_t *len, size_t *off) 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. */ /* Set default format keys for a session. */
void static void
format_defaults_session(struct format_tree *ft, struct session *s) format_defaults_session(struct format_tree *ft, struct session *s)
{ {
struct session_group *sg; 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. */ /* Set default format keys for a client. */
void static void
format_defaults_client(struct format_tree *ft, struct client *c) format_defaults_client(struct format_tree *ft, struct client *c)
{ {
struct session *s; struct session *s;
@@ -1098,7 +1103,7 @@ format_defaults_window(struct format_tree *ft, struct window *w)
} }
/* Set default format keys for a winlink. */ /* Set default format keys for a winlink. */
void static void
format_defaults_winlink(struct format_tree *ft, struct session *s, format_defaults_winlink(struct format_tree *ft, struct session *s,
struct winlink *wl) struct winlink *wl)
{ {

35
grid.c
View File

@@ -43,16 +43,17 @@ const struct grid_cell_entry grid_default_entry = {
0, { .data = { 0, 8, 8, ' ' } } 0, { .data = { 0, 8, 8, ' ' } }
}; };
void grid_reflow_copy(struct grid_line *, u_int, struct grid_line *l, static void grid_reflow_copy(struct grid_line *, u_int, struct grid_line *,
u_int, u_int); u_int, u_int);
void grid_reflow_join(struct grid *, u_int *, struct grid_line *, u_int); static void grid_reflow_join(struct grid *, u_int *, struct grid_line *,
void grid_reflow_split(struct grid *, u_int *, struct grid_line *, u_int, u_int);
u_int); static void grid_reflow_split(struct grid *, u_int *, struct grid_line *,
void grid_reflow_move(struct grid *, u_int *, struct grid_line *); u_int, u_int);
size_t grid_string_cells_fg(const struct grid_cell *, int *); static void grid_reflow_move(struct grid *, u_int *, struct grid_line *);
size_t grid_string_cells_bg(const struct grid_cell *, int *); static size_t grid_string_cells_fg(const struct grid_cell *, int *);
void grid_string_cells_code(const struct grid_cell *, static size_t grid_string_cells_bg(const struct grid_cell *, int *);
const struct grid_cell *, char *, size_t, int); static void grid_string_cells_code(const struct grid_cell *,
const struct grid_cell *, char *, size_t, int);
/* Copy default into a cell. */ /* Copy default into a cell. */
static void 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. */ /* Get ANSI foreground sequence. */
size_t static size_t
grid_string_cells_fg(const struct grid_cell *gc, int *values) grid_string_cells_fg(const struct grid_cell *gc, int *values)
{ {
size_t n; size_t n;
@@ -522,7 +523,7 @@ grid_string_cells_fg(const struct grid_cell *gc, int *values)
} }
/* Get ANSI background sequence. */ /* Get ANSI background sequence. */
size_t static size_t
grid_string_cells_bg(const struct grid_cell *gc, int *values) grid_string_cells_bg(const struct grid_cell *gc, int *values)
{ {
size_t n; 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 * given a current state. The output buffer must be able to hold at least 57
* bytes. * bytes.
*/ */
void static void
grid_string_cells_code(const struct grid_cell *lastgc, grid_string_cells_code(const struct grid_cell *lastgc,
const struct grid_cell *gc, char *buf, size_t len, int escape_c0) 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. */ /* 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, grid_reflow_copy(struct grid_line *dst_gl, u_int to, struct grid_line *src_gl,
u_int from, u_int to_copy) 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. */ /* Join line data. */
void static void
grid_reflow_join(struct grid *dst, u_int *py, struct grid_line *src_gl, grid_reflow_join(struct grid *dst, u_int *py, struct grid_line *src_gl,
u_int new_x) 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. */ /* Split line data. */
void static void
grid_reflow_split(struct grid *dst, u_int *py, struct grid_line *src_gl, grid_reflow_split(struct grid *dst, u_int *py, struct grid_line *src_gl,
u_int new_x, u_int offset) 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. */ /* Move line data. */
void static void
grid_reflow_move(struct grid *dst, u_int *py, struct grid_line *src_gl) grid_reflow_move(struct grid *dst, u_int *py, struct grid_line *src_gl)
{ {
struct grid_line *dst_gl; struct grid_line *dst_gl;

View File

@@ -29,8 +29,7 @@ struct hooks {
}; };
static int hooks_cmp(struct hook *, struct hook *); static int hooks_cmp(struct hook *, struct hook *);
RB_PROTOTYPE(hooks_tree, hook, entry, hooks_cmp); RB_GENERATE_STATIC(hooks_tree, hook, entry, hooks_cmp);
RB_GENERATE(hooks_tree, hook, entry, hooks_cmp);
static struct hook *hooks_find1(struct hooks *, const char *); static struct hook *hooks_find1(struct hooks *, const char *);
static void hooks_free1(struct hooks *, struct hook *); static void hooks_free1(struct hooks *, struct hook *);

8
job.c
View File

@@ -33,8 +33,8 @@
* output. * output.
*/ */
void job_callback(struct bufferevent *, short, void *); static void job_callback(struct bufferevent *, short, void *);
void job_write_callback(struct bufferevent *, void *); static void job_write_callback(struct bufferevent *, void *);
/* All jobs list. */ /* All jobs list. */
struct joblist all_jobs = LIST_HEAD_INITIALIZER(all_jobs); 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). */ /* Called when output buffer falls below low watermark (default is 0). */
void static void
job_write_callback(__unused struct bufferevent *bufev, void *data) job_write_callback(__unused struct bufferevent *bufev, void *data)
{ {
struct job *job = data; struct job *job = data;
@@ -165,7 +165,7 @@ job_write_callback(__unused struct bufferevent *bufev, void *data)
} }
/* Job buffer error callback. */ /* Job buffer error callback. */
void static void
job_callback(__unused struct bufferevent *bufev, __unused short events, job_callback(__unused struct bufferevent *bufev, __unused short events,
void *data) void *data)
{ {

View File

@@ -25,7 +25,7 @@
static key_code key_string_search_table(const char *); static key_code key_string_search_table(const char *);
static key_code key_string_get_modifiers(const char **); static key_code key_string_get_modifiers(const char **);
const struct { static const struct {
const char *string; const char *string;
key_code key; key_code key;
} key_string_table[] = { } key_string_table[] = {

View File

@@ -27,11 +27,11 @@
* one-off and generate a layout tree. * one-off and generate a layout tree.
*/ */
void layout_set_even_h(struct window *); static void layout_set_even_h(struct window *);
void layout_set_even_v(struct window *); static void layout_set_even_v(struct window *);
void layout_set_main_h(struct window *); static void layout_set_main_h(struct window *);
void layout_set_main_v(struct window *); static void layout_set_main_v(struct window *);
void layout_set_tiled(struct window *); static void layout_set_tiled(struct window *);
const struct { const struct {
const char *name; const char *name;
@@ -114,7 +114,7 @@ layout_set_previous(struct window *w)
return (layout); return (layout);
} }
void static void
layout_set_even_h(struct window *w) layout_set_even_h(struct window *w)
{ {
struct window_pane *wp; struct window_pane *wp;
@@ -168,7 +168,7 @@ layout_set_even_h(struct window *w)
server_redraw_window(w); server_redraw_window(w);
} }
void static void
layout_set_even_v(struct window *w) layout_set_even_v(struct window *w)
{ {
struct window_pane *wp; struct window_pane *wp;
@@ -222,7 +222,7 @@ layout_set_even_v(struct window *w)
server_redraw_window(w); server_redraw_window(w);
} }
void static void
layout_set_main_h(struct window *w) layout_set_main_h(struct window *w)
{ {
struct window_pane *wp; struct window_pane *wp;
@@ -345,7 +345,7 @@ layout_set_main_h(struct window *w)
server_redraw_window(w); server_redraw_window(w);
} }
void static void
layout_set_main_v(struct window *w) layout_set_main_v(struct window *w)
{ {
struct window_pane *wp; struct window_pane *wp;

View File

@@ -54,7 +54,7 @@ struct mode_key_entry {
}; };
/* Edit keys command strings. */ /* 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_BACKSPACE, "backspace" },
{ MODEKEYEDIT_CANCEL, "cancel" }, { MODEKEYEDIT_CANCEL, "cancel" },
{ MODEKEYEDIT_COMPLETE, "complete" }, { MODEKEYEDIT_COMPLETE, "complete" },
@@ -89,7 +89,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
}; };
/* Choice keys command strings. */ /* 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_BACKSPACE, "backspace" },
{ MODEKEYCHOICE_BOTTOMLINE, "bottom-line"}, { MODEKEYCHOICE_BOTTOMLINE, "bottom-line"},
{ MODEKEYCHOICE_CANCEL, "cancel" }, { MODEKEYCHOICE_CANCEL, "cancel" },
@@ -114,7 +114,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_choice[] = {
}; };
/* Copy keys command strings. */ /* 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_APPENDSELECTION, "append-selection" },
{ MODEKEYCOPY_BACKTOINDENTATION, "back-to-indentation" }, { MODEKEYCOPY_BACKTOINDENTATION, "back-to-indentation" },
{ MODEKEYCOPY_BOTTOMLINE, "bottom-line" }, { MODEKEYCOPY_BOTTOMLINE, "bottom-line" },
@@ -170,7 +170,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_copy[] = {
}; };
/* vi editing keys. */ /* 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 }, { '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL, 1 },
{ '\010' /* C-h */, 0, MODEKEYEDIT_BACKSPACE, 1 }, { '\010' /* C-h */, 0, MODEKEYEDIT_BACKSPACE, 1 },
{ '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE, 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; struct mode_key_tree mode_key_tree_vi_edit;
/* vi choice selection keys. */ /* 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 }, { '0' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
{ '1' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 }, { '1' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
{ '2' | 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; struct mode_key_tree mode_key_tree_vi_choice;
/* vi copy mode keys. */ /* 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_STARTSELECTION, 1 },
{ '"', 0, MODEKEYCOPY_STARTNAMEDBUFFER, 1 }, { '"', 0, MODEKEYCOPY_STARTNAMEDBUFFER, 1 },
{ '$', 0, MODEKEYCOPY_ENDOFLINE, 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; struct mode_key_tree mode_key_tree_vi_copy;
/* emacs editing keys. */ /* 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 }, { '\001' /* C-a */, 0, MODEKEYEDIT_STARTOFLINE, 1 },
{ '\002' /* C-b */, 0, MODEKEYEDIT_CURSORLEFT, 1 }, { '\002' /* C-b */, 0, MODEKEYEDIT_CURSORLEFT, 1 },
{ '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL, 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; struct mode_key_tree mode_key_tree_emacs_edit;
/* emacs choice selection keys. */ /* 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 }, { '0' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
{ '1' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 }, { '1' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
{ '2' | 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; struct mode_key_tree mode_key_tree_emacs_choice;
/* emacs copy mode keys. */ /* 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_NEXTPAGE, 1 },
{ ',', 0, MODEKEYCOPY_JUMPREVERSE, 1 }, { ',', 0, MODEKEYCOPY_JUMPREVERSE, 1 },
{ ';', 0, MODEKEYCOPY_JUMPAGAIN, 1 }, { ';', 0, MODEKEYCOPY_JUMPAGAIN, 1 },

View File

@@ -25,10 +25,10 @@
#include "tmux.h" #include "tmux.h"
void name_time_callback(int, short, void *); static void name_time_callback(int, short, void *);
int name_time_expired(struct window *, struct timeval *); static int name_time_expired(struct window *, struct timeval *);
void static void
name_time_callback(__unused int fd, __unused short events, void *arg) name_time_callback(__unused int fd, __unused short events, void *arg)
{ {
struct window *w = 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); log_debug("@%u name timer expired", w->id);
} }
int static int
name_time_expired(struct window *w, struct timeval *tv) name_time_expired(struct window *w, struct timeval *tv)
{ {
struct timeval offset; struct timeval offset;

View File

@@ -43,12 +43,13 @@ struct notify_entry {
TAILQ_ENTRY(notify_entry) entry; TAILQ_ENTRY(notify_entry) entry;
}; };
TAILQ_HEAD(, notify_entry) notify_queue = TAILQ_HEAD_INITIALIZER(notify_queue); TAILQ_HEAD(notify_queue, notify_entry);
int notify_enabled = 1; static struct notify_queue notify_queue = TAILQ_HEAD_INITIALIZER(notify_queue);
static int notify_enabled = 1;
void notify_drain(void); static void notify_drain(void);
void notify_add(enum notify_type, struct client *, struct session *, static void notify_add(enum notify_type, struct client *, struct session *,
struct window *); struct window *);
void void
notify_enable(void) notify_enable(void)
@@ -63,7 +64,7 @@ notify_disable(void)
notify_enabled = 0; notify_enabled = 0;
} }
void static void
notify_add(enum notify_type type, struct client *c, struct session *s, notify_add(enum notify_type type, struct client *c, struct session *s,
struct window *w) struct window *w)
{ {
@@ -84,7 +85,7 @@ notify_add(enum notify_type type, struct client *c, struct session *s,
w->references++; w->references++;
} }
void static void
notify_drain(void) notify_drain(void)
{ {
struct notify_entry *ne, *ne1; struct notify_entry *ne, *ne1;

View File

@@ -35,8 +35,7 @@ struct options {
}; };
static int options_cmp(struct options_entry *, struct options_entry *); static int options_cmp(struct options_entry *, struct options_entry *);
RB_PROTOTYPE(options_tree, options_entry, entry, options_cmp); RB_GENERATE_STATIC(options_tree, options_entry, entry, options_cmp);
RB_GENERATE(options_tree, options_entry, entry, options_cmp);
static void options_free1(struct options *, struct options_entry *); static void options_free1(struct options *, struct options_entry *);

View File

@@ -36,10 +36,10 @@
#define is_stopped(p) \ #define is_stopped(p) \
((p)->p_stat == SSTOP || (p)->p_stat == SDEAD) ((p)->p_stat == SSTOP || (p)->p_stat == SDEAD)
struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *); static struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *);
char *get_proc_name(int, char *); char *get_proc_name(int, char *);
struct kinfo_proc * static struct kinfo_proc *
cmp_procs(struct kinfo_proc *p1, struct kinfo_proc *p2) cmp_procs(struct kinfo_proc *p1, struct kinfo_proc *p2)
{ {
if (is_runnable(p1) && !is_runnable(p2)) if (is_runnable(p1) && !is_runnable(p2))

View File

@@ -22,21 +22,22 @@
#include "tmux.h" #include "tmux.h"
int screen_redraw_cell_border1(struct window_pane *, u_int, u_int); static int screen_redraw_cell_border1(struct window_pane *, u_int, u_int);
int screen_redraw_cell_border(struct client *, u_int, u_int); static int screen_redraw_cell_border(struct client *, u_int, u_int);
int screen_redraw_check_cell(struct client *, u_int, u_int, int, static int screen_redraw_check_cell(struct client *, u_int, u_int, int,
struct window_pane **); struct window_pane **);
int screen_redraw_check_is(u_int, u_int, int, int, struct window *, static int screen_redraw_check_is(u_int, u_int, int, int, struct window *,
struct window_pane *, struct window_pane *); struct window_pane *, struct window_pane *);
int screen_redraw_make_pane_status(struct client *, struct window *, static int screen_redraw_make_pane_status(struct client *, struct window *,
struct window_pane *); struct window_pane *);
void screen_redraw_draw_pane_status(struct client *, int); static void screen_redraw_draw_pane_status(struct client *, int);
void screen_redraw_draw_borders(struct client *, int, int, u_int); static void screen_redraw_draw_borders(struct client *, int, int, u_int);
void screen_redraw_draw_panes(struct client *, u_int); static void screen_redraw_draw_panes(struct client *, u_int);
void screen_redraw_draw_status(struct client *, u_int); static 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_number(struct client *, struct window_pane *,
u_int);
#define CELL_INSIDE 0 #define CELL_INSIDE 0
#define CELL_LEFTRIGHT 1 #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 #define CELL_STATUS_BOTTOM 2
/* Check if cell is on the border of a particular pane. */ /* 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) screen_redraw_cell_border1(struct window_pane *wp, u_int px, u_int py)
{ {
/* Inside pane. */ /* 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. */ /* 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) screen_redraw_cell_border(struct client *c, u_int px, u_int py)
{ {
struct window *w = c->session->curw->window; 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. */ /* 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, screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status,
struct window_pane **wpp) 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; int borders;
u_int right, line; u_int right, line;
*wpp = NULL;
if (px > w->sx || py > w->sy) if (px > w->sx || py > w->sy)
return (CELL_OUTSIDE); 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); return (CELL_OUTSIDE);
} }
/* Check if the border of a particular pane. */ /* 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, 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) 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. */ /* Update pane status. */
int static int
screen_redraw_make_pane_status(struct client *c, struct window *w, screen_redraw_make_pane_status(struct client *c, struct window *w,
struct window_pane *wp) struct window_pane *wp)
{ {
@@ -303,7 +305,7 @@ screen_redraw_make_pane_status(struct client *c, struct window *w,
} }
/* Draw pane status. */ /* Draw pane status. */
void static void
screen_redraw_draw_pane_status(struct client *c, int pane_status) screen_redraw_draw_pane_status(struct client *c, int pane_status)
{ {
struct window *w = c->session->curw->window; struct window *w = c->session->curw->window;
@@ -418,7 +420,7 @@ screen_redraw_pane(struct client *c, struct window_pane *wp)
} }
/* Draw the borders. */ /* Draw the borders. */
void static void
screen_redraw_draw_borders(struct client *c, int status, int pane_status, screen_redraw_draw_borders(struct client *c, int status, int pane_status,
u_int top) u_int top)
{ {
@@ -505,7 +507,7 @@ screen_redraw_draw_borders(struct client *c, int status, int pane_status,
} }
/* Draw the panes. */ /* Draw the panes. */
void static void
screen_redraw_draw_panes(struct client *c, u_int top) screen_redraw_draw_panes(struct client *c, u_int top)
{ {
struct window *w = c->session->curw->window; 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. */ /* Draw the status line. */
void static void
screen_redraw_draw_status(struct client *c, u_int top) screen_redraw_draw_status(struct client *c, u_int top)
{ {
struct tty *tty = &c->tty; struct tty *tty = &c->tty;
@@ -536,7 +538,7 @@ screen_redraw_draw_status(struct client *c, u_int top)
} }
/* Draw number on a pane. */ /* Draw number on a pane. */
void static void
screen_redraw_draw_number(struct client *c, struct window_pane *wp, u_int top) screen_redraw_draw_number(struct client *c, struct window_pane *wp, u_int top)
{ {
struct tty *tty = &c->tty; struct tty *tty = &c->tty;

View File

@@ -24,8 +24,8 @@
#include "tmux.h" #include "tmux.h"
void screen_resize_x(struct screen *, u_int); static void screen_resize_x(struct screen *, u_int);
void screen_resize_y(struct screen *, u_int); static void screen_resize_y(struct screen *, u_int);
/* Create a new screen. */ /* Create a new screen. */
void void
@@ -139,7 +139,7 @@ screen_resize(struct screen *s, u_int sx, u_int sy, int reflow)
screen_reflow(s, sx); screen_reflow(s, sx);
} }
void static void
screen_resize_x(struct screen *s, u_int sx) screen_resize_x(struct screen *s, u_int sx)
{ {
struct grid *gd = s->grid; struct grid *gd = s->grid;
@@ -161,7 +161,7 @@ screen_resize_x(struct screen *s, u_int sx)
gd->sx = sx; gd->sx = sx;
} }
void static void
screen_resize_y(struct screen *s, u_int sy) screen_resize_y(struct screen *s, u_int sy)
{ {
struct grid *gd = s->grid; struct grid *gd = s->grid;
@@ -221,8 +221,8 @@ screen_resize_y(struct screen *s, u_int sy)
needed = sy - oldy; needed = sy - oldy;
/* /*
* Try to pull as much as possible out of scrolled history, if is * Try to pull as much as possible out of scrolled history, if
* is enabled. * is is enabled.
*/ */
available = gd->hscrolled; available = gd->hscrolled;
if (gd->flags & GRID_HISTORY && available > 0) { if (gd->flags & GRID_HISTORY && available > 0) {

View File

@@ -32,21 +32,21 @@
#include "tmux.h" #include "tmux.h"
void server_client_free(int, short, void *); static void server_client_free(int, short, void *);
void server_client_check_focus(struct window_pane *); static void server_client_check_focus(struct window_pane *);
void server_client_check_resize(struct window_pane *); static void server_client_check_resize(struct window_pane *);
key_code server_client_check_mouse(struct client *); static key_code server_client_check_mouse(struct client *);
void server_client_repeat_timer(int, short, void *); static void server_client_repeat_timer(int, short, void *);
void server_client_check_exit(struct client *); static void server_client_check_exit(struct client *);
void server_client_check_redraw(struct client *); static void server_client_check_redraw(struct client *);
void server_client_set_title(struct client *); static void server_client_set_title(struct client *);
void server_client_reset_state(struct client *); static void server_client_reset_state(struct client *);
int server_client_assume_paste(struct session *); static int server_client_assume_paste(struct session *);
void server_client_dispatch(struct imsg *, void *); static void server_client_dispatch(struct imsg *, void *);
void server_client_dispatch_command(struct client *, struct imsg *); static void server_client_dispatch_command(struct client *, struct imsg *);
void server_client_dispatch_identify(struct client *, struct imsg *); static void server_client_dispatch_identify(struct client *, struct imsg *);
void server_client_dispatch_shell(struct client *); static void server_client_dispatch_shell(struct client *);
/* Check if this client is inside this server. */ /* Check if this client is inside this server. */
int int
@@ -264,7 +264,7 @@ server_client_unref(struct client *c)
} }
/* Free dead client. */ /* Free dead client. */
void static void
server_client_free(__unused int fd, __unused short events, void *arg) server_client_free(__unused int fd, __unused short events, void *arg)
{ {
struct client *c = arg; struct client *c = arg;
@@ -289,7 +289,7 @@ server_client_detach(struct client *c, enum msgtype msgtype)
} }
/* Check for mouse keys. */ /* Check for mouse keys. */
key_code static key_code
server_client_check_mouse(struct client *c) server_client_check_mouse(struct client *c)
{ {
struct session *s = c->session; 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? */ /* Is this fast enough to probably be a paste? */
int static int
server_client_assume_paste(struct session *s) server_client_assume_paste(struct session *s)
{ {
struct timeval tv; 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. */ /* Check if pane should be resized. */
void static void
server_client_check_resize(struct window_pane *wp) server_client_check_resize(struct window_pane *wp)
{ {
struct timeval tv = { .tv_usec = 250000 }; struct timeval tv = { .tv_usec = 250000 };
@@ -817,7 +817,7 @@ server_client_check_resize(struct window_pane *wp)
} }
/* Check whether pane should be focused. */ /* Check whether pane should be focused. */
void static void
server_client_check_focus(struct window_pane *wp) server_client_check_focus(struct window_pane *wp)
{ {
struct client *c; struct client *c;
@@ -878,7 +878,7 @@ focused:
* tty_region/tty_reset/tty_update_mode already take care of not resetting * tty_region/tty_reset/tty_update_mode already take care of not resetting
* things that are already in their default state. * things that are already in their default state.
*/ */
void static void
server_client_reset_state(struct client *c) server_client_reset_state(struct client *c)
{ {
struct window *w = c->session->curw->window; struct window *w = c->session->curw->window;
@@ -914,7 +914,7 @@ server_client_reset_state(struct client *c)
} }
/* Repeat time callback. */ /* Repeat time callback. */
void static void
server_client_repeat_timer(__unused int fd, __unused short events, void *data) server_client_repeat_timer(__unused int fd, __unused short events, void *data)
{ {
struct client *c = 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. */ /* Check if client should be exited. */
void static void
server_client_check_exit(struct client *c) server_client_check_exit(struct client *c)
{ {
if (!(c->flags & CLIENT_EXIT)) if (!(c->flags & CLIENT_EXIT))
@@ -945,7 +945,7 @@ server_client_check_exit(struct client *c)
} }
/* Check for client redraws. */ /* Check for client redraws. */
void static void
server_client_check_redraw(struct client *c) server_client_check_redraw(struct client *c)
{ {
struct session *s = c->session; struct session *s = c->session;
@@ -1001,7 +1001,7 @@ server_client_check_redraw(struct client *c)
} }
/* Set client title. */ /* Set client title. */
void static void
server_client_set_title(struct client *c) server_client_set_title(struct client *c)
{ {
struct session *s = c->session; struct session *s = c->session;
@@ -1026,7 +1026,7 @@ server_client_set_title(struct client *c)
} }
/* Dispatch message from client. */ /* Dispatch message from client. */
void static void
server_client_dispatch(struct imsg *imsg, void *arg) server_client_dispatch(struct imsg *imsg, void *arg)
{ {
struct client *c = arg; struct client *c = arg;
@@ -1130,7 +1130,7 @@ server_client_dispatch(struct imsg *imsg, void *arg)
} }
/* Handle command message. */ /* Handle command message. */
void static void
server_client_dispatch_command(struct client *c, struct imsg *imsg) server_client_dispatch_command(struct client *c, struct imsg *imsg)
{ {
struct msg_command_data data; struct msg_command_data data;
@@ -1183,7 +1183,7 @@ error:
} }
/* Handle identify message. */ /* Handle identify message. */
void static void
server_client_dispatch_identify(struct client *c, struct imsg *imsg) server_client_dispatch_identify(struct client *c, struct imsg *imsg)
{ {
const char *data, *home; const char *data, *home;
@@ -1291,7 +1291,7 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
} }
/* Handle shell message. */ /* Handle shell message. */
void static void
server_client_dispatch_shell(struct client *c) server_client_dispatch_shell(struct client *c)
{ {
const char *shell; const char *shell;

View File

@@ -28,8 +28,8 @@
#include "tmux.h" #include "tmux.h"
struct session *server_next_session(struct session *); static struct session *server_next_session(struct session *);
void server_callback_identify(int, short, void *); static void server_callback_identify(int, short, void *);
void void
server_fill_environ(struct session *s, struct environ *env) 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) server_next_session(struct session *s)
{ {
struct session *s_loop, *s_out; struct session *s_loop, *s_out;
@@ -454,7 +454,7 @@ server_clear_identify(struct client *c, struct window_pane *wp)
server_redraw_client(c); server_redraw_client(c);
} }
void static void
server_callback_identify(__unused int fd, __unused short events, void *data) server_callback_identify(__unused int fd, __unused short events, void *data)
{ {
server_clear_identify(data, NULL); server_clear_identify(data, NULL);

View File

@@ -44,21 +44,20 @@
struct clients clients; struct clients clients;
struct tmuxproc *server_proc; struct tmuxproc *server_proc;
int server_fd; static int server_fd;
int server_exit; static int server_exit;
struct event server_ev_accept; static struct event server_ev_accept;
struct cmd_find_state marked_pane; struct cmd_find_state marked_pane;
int server_create_socket(void); static int server_create_socket(void);
int server_loop(void); static int server_loop(void);
int server_should_exit(void); static void server_send_exit(void);
void server_send_exit(void); static void server_accept(int, short, void *);
void server_accept(int, short, void *); static void server_signal(int);
void server_signal(int); static void server_child_signal(void);
void server_child_signal(void); static void server_child_exited(pid_t, int);
void server_child_exited(pid_t, int); static void server_child_stopped(pid_t, int);
void server_child_stopped(pid_t, int);
/* Set marked pane. */ /* Set marked pane. */
void void
@@ -99,7 +98,7 @@ server_check_marked(void)
} }
/* Create server socket. */ /* Create server socket. */
int static int
server_create_socket(void) server_create_socket(void)
{ {
struct sockaddr_un sa; struct sockaddr_un sa;
@@ -187,7 +186,7 @@ server_start(struct event_base *base, int lockfd, char *lockfile)
} }
/* Server loop callback. */ /* Server loop callback. */
int static int
server_loop(void) server_loop(void)
{ {
struct client *c; struct client *c;
@@ -216,7 +215,7 @@ server_loop(void)
} }
/* Exit the server by killing all clients and windows. */ /* Exit the server by killing all clients and windows. */
void static void
server_send_exit(void) server_send_exit(void)
{ {
struct client *c, *c1; struct client *c, *c1;
@@ -273,7 +272,7 @@ server_update_socket(void)
} }
/* Callback for server socket. */ /* Callback for server socket. */
void static void
server_accept(int fd, short events, __unused void *data) server_accept(int fd, short events, __unused void *data)
{ {
struct sockaddr_storage sa; struct sockaddr_storage sa;
@@ -326,7 +325,7 @@ server_add_accept(int timeout)
} }
/* Signal handler. */ /* Signal handler. */
void static void
server_signal(int sig) server_signal(int sig)
{ {
int fd; int fd;
@@ -353,7 +352,7 @@ server_signal(int sig)
} }
/* Handle SIGCHLD. */ /* Handle SIGCHLD. */
void static void
server_child_signal(void) server_child_signal(void)
{ {
int status; int status;
@@ -376,7 +375,7 @@ server_child_signal(void)
} }
/* Handle exited children. */ /* Handle exited children. */
void static void
server_child_exited(pid_t pid, int status) server_child_exited(pid_t pid, int status)
{ {
struct window *w, *w1; struct window *w, *w1;
@@ -402,7 +401,7 @@ server_child_exited(pid_t pid, int status)
} }
/* Handle stopped children. */ /* Handle stopped children. */
void static void
server_child_stopped(pid_t pid, int status) server_child_stopped(pid_t pid, int status)
{ {
struct window *w; struct window *w;

View File

@@ -27,16 +27,16 @@
#include "tmux.h" #include "tmux.h"
struct sessions sessions; struct sessions sessions;
u_int next_session_id; static u_int next_session_id;
struct session_groups session_groups; 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 *); static struct winlink *session_next_alert(struct winlink *);
struct winlink *session_previous_alert(struct winlink *); static struct winlink *session_previous_alert(struct winlink *);
RB_GENERATE(sessions, session, entry, session_cmp); RB_GENERATE(sessions, session, entry, session_cmp);
@@ -182,7 +182,7 @@ session_unref(struct session *s)
} }
/* Free session. */ /* Free session. */
void static void
session_free(__unused int fd, __unused short events, void *arg) session_free(__unused int fd, __unused short events, void *arg)
{ {
struct session *s = arg; struct session *s = arg;
@@ -239,7 +239,7 @@ session_check_name(const char *name)
} }
/* Lock session if it has timed out. */ /* Lock session if it has timed out. */
void static void
session_lock_timer(__unused int fd, __unused short events, void *arg) session_lock_timer(__unused int fd, __unused short events, void *arg)
{ {
struct session *s = arg; struct session *s = arg;
@@ -426,7 +426,7 @@ session_is_linked(struct session *s, struct window *w)
return (w->references != 1); return (w->references != 1);
} }
struct winlink * static struct winlink *
session_next_alert(struct winlink *wl) session_next_alert(struct winlink *wl)
{ {
while (wl != NULL) { while (wl != NULL) {
@@ -457,7 +457,7 @@ session_next(struct session *s, int alert)
return (session_set_current(s, wl)); return (session_set_current(s, wl));
} }
struct winlink * static struct winlink *
session_previous_alert(struct winlink *wl) session_previous_alert(struct winlink *wl)
{ {
while (wl != NULL) { while (wl != NULL) {

View File

@@ -24,12 +24,12 @@
#include "tmux.h" #include "tmux.h"
struct event ev_sighup; static struct event ev_sighup;
struct event ev_sigchld; static struct event ev_sigchld;
struct event ev_sigcont; static struct event ev_sigcont;
struct event ev_sigterm; static struct event ev_sigterm;
struct event ev_sigusr1; static struct event ev_sigusr1;
struct event ev_sigwinch; static struct event ev_sigwinch;
void void
set_signals(void (*handler)(int, short, void *), void *arg) set_signals(void (*handler)(int, short, void *), void *arg)

View File

@@ -29,33 +29,33 @@
#include "tmux.h" #include "tmux.h"
char *status_redraw_get_left(struct client *, time_t, struct grid_cell *, static char *status_redraw_get_left(struct client *, time_t,
size_t *); struct grid_cell *, size_t *);
char *status_redraw_get_right(struct client *, time_t, struct grid_cell *, static char *status_redraw_get_right(struct client *, time_t,
size_t *); struct grid_cell *, size_t *);
char *status_print(struct client *, struct winlink *, time_t, static char *status_print(struct client *, struct winlink *, time_t,
struct grid_cell *); struct grid_cell *);
char *status_replace(struct client *, struct winlink *, const char *, time_t); static char *status_replace(struct client *, struct winlink *, const char *,
void status_message_callback(int, short, void *); time_t);
void status_timer_callback(int, short, void *); static void status_message_callback(int, short, void *);
static void status_timer_callback(int, short, void *);
const char *status_prompt_up_history(u_int *); static char *status_prompt_find_history_file(void);
const char *status_prompt_down_history(u_int *); static const char *status_prompt_up_history(u_int *);
void status_prompt_add_history(const char *); static const char *status_prompt_down_history(u_int *);
static void status_prompt_add_history(const char *);
const char **status_prompt_complete_list(u_int *, const char *); static const char **status_prompt_complete_list(u_int *, const char *);
char *status_prompt_complete_prefix(const char **, u_int); static char *status_prompt_complete_prefix(const char **, u_int);
char *status_prompt_complete(struct session *, const char *); static char *status_prompt_complete(struct session *, const char *);
char *status_prompt_find_history_file(void);
/* Status prompt history. */ /* Status prompt history. */
#define PROMPT_HISTORY 100 #define PROMPT_HISTORY 100
char **status_prompt_hlist; static char **status_prompt_hlist;
u_int status_prompt_hsize; static u_int status_prompt_hsize;
/* Find the history file to load/save from/to. */ /* Find the history file to load/save from/to. */
char * static char *
status_prompt_find_history_file(void) status_prompt_find_history_file(void)
{ {
const char *home, *history_file; const char *home, *history_file;
@@ -144,7 +144,7 @@ status_prompt_save_history(void)
} }
/* Status timer callback. */ /* Status timer callback. */
void static void
status_timer_callback(__unused int fd, __unused short events, void *arg) status_timer_callback(__unused int fd, __unused short events, void *arg)
{ {
struct client *c = arg; struct client *c = arg;
@@ -207,7 +207,7 @@ status_at_line(struct client *c)
} }
/* Retrieve options for left string. */ /* Retrieve options for left string. */
char * static char *
status_redraw_get_left(struct client *c, time_t t, struct grid_cell *gc, status_redraw_get_left(struct client *c, time_t t, struct grid_cell *gc,
size_t *size) 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. */ /* Retrieve options for right string. */
char * static char *
status_redraw_get_right(struct client *c, time_t t, struct grid_cell *gc, status_redraw_get_right(struct client *c, time_t t, struct grid_cell *gc,
size_t *size) size_t *size)
{ {
@@ -493,7 +493,7 @@ out:
} }
/* Replace special sequences in fmt. */ /* Replace special sequences in fmt. */
char * static char *
status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t) status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t)
{ {
struct format_tree *ft; 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. */ /* Return winlink status line entry and adjust gc as necessary. */
char * static char *
status_print(struct client *c, struct winlink *wl, time_t t, status_print(struct client *c, struct winlink *wl, time_t t,
struct grid_cell *gc) struct grid_cell *gc)
{ {
@@ -607,7 +607,7 @@ status_message_clear(struct client *c)
} }
/* Clear status line message after timer expires. */ /* Clear status line message after timer expires. */
void static void
status_message_callback(__unused int fd, __unused short event, void *data) status_message_callback(__unused int fd, __unused short event, void *data)
{ {
struct client *c = data; struct client *c = data;
@@ -1139,7 +1139,7 @@ status_prompt_key(struct client *c, key_code key)
} }
/* Get previous line from the history. */ /* Get previous line from the history. */
const char * static const char *
status_prompt_up_history(u_int *idx) status_prompt_up_history(u_int *idx)
{ {
/* /*
@@ -1154,7 +1154,7 @@ status_prompt_up_history(u_int *idx)
} }
/* Get next line from the history. */ /* Get next line from the history. */
const char * static const char *
status_prompt_down_history(u_int *idx) status_prompt_down_history(u_int *idx)
{ {
if (status_prompt_hsize == 0 || *idx == 0) if (status_prompt_hsize == 0 || *idx == 0)
@@ -1166,7 +1166,7 @@ status_prompt_down_history(u_int *idx)
} }
/* Add line to the history. */ /* Add line to the history. */
void static void
status_prompt_add_history(const char *line) status_prompt_add_history(const char *line)
{ {
size_t size; size_t size;
@@ -1191,7 +1191,7 @@ status_prompt_add_history(const char *line)
} }
/* Build completion list. */ /* Build completion list. */
const char ** static const char **
status_prompt_complete_list(u_int *size, const char *s) status_prompt_complete_list(u_int *size, const char *s)
{ {
const char **list = NULL, **layout; const char **list = NULL, **layout;
@@ -1225,7 +1225,7 @@ status_prompt_complete_list(u_int *size, const char *s)
} }
/* Find longest prefix. */ /* Find longest prefix. */
char * static char *
status_prompt_complete_prefix(const char **list, u_int size) status_prompt_complete_prefix(const char **list, u_int size)
{ {
char *out; char *out;
@@ -1246,7 +1246,7 @@ status_prompt_complete_prefix(const char **list, u_int size)
} }
/* Complete word. */ /* Complete word. */
char * static char *
status_prompt_complete(struct session *sess, const char *s) status_prompt_complete(struct session *sess, const char *s)
{ {
const char **list = NULL, *colon; const char **list = NULL, *colon;

6
tmux.c
View File

@@ -44,10 +44,10 @@ struct hooks *global_hooks;
struct timeval start_time; struct timeval start_time;
const char *socket_path; const char *socket_path;
__dead void usage(void); static __dead void usage(void);
static char *make_label(const char *); static char *make_label(const char *);
__dead void static __dead void
usage(void) usage(void)
{ {
fprintf(stderr, fprintf(stderr,

View File

@@ -50,7 +50,7 @@ struct tty_default_key_raw {
const char *string; const char *string;
key_code key; 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 * Numeric keypad. Just use the vt100 escape sequences here and always
* put the terminal into keypad_xmit mode. Translation of numbers * put the terminal into keypad_xmit mode. Translation of numbers
@@ -170,7 +170,7 @@ struct tty_default_key_code {
enum tty_code_code code; enum tty_code_code code;
key_code key; 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. */ /* Function keys. */
{ TTYC_KF1, KEYC_F1 }, { TTYC_KF1, KEYC_F1 },
{ TTYC_KF2, KEYC_F2 }, { TTYC_KF2, KEYC_F2 },

View File

@@ -27,8 +27,8 @@
#include "tmux.h" #include "tmux.h"
void tty_term_override(struct tty_term *, const char *); static void tty_term_override(struct tty_term *, const char *);
char *tty_term_strip(const char *); static char *tty_term_strip(const char *);
struct tty_terms tty_terms = LIST_HEAD_INITIALIZER(tty_terms); struct tty_terms tty_terms = LIST_HEAD_INITIALIZER(tty_terms);
@@ -53,7 +53,7 @@ struct tty_term_code_entry {
const char *name; 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_ACSC] = { TTYCODE_STRING, "acsc" },
[TTYC_AX] = { TTYCODE_FLAG, "AX" }, [TTYC_AX] = { TTYCODE_FLAG, "AX" },
[TTYC_BCE] = { TTYCODE_FLAG, "bce" }, [TTYC_BCE] = { TTYCODE_FLAG, "bce" },
@@ -264,7 +264,7 @@ tty_term_ncodes(void)
return (nitems(tty_term_codes)); return (nitems(tty_term_codes));
} }
char * static char *
tty_term_strip(const char *s) tty_term_strip(const char *s)
{ {
const char *ptr; const char *ptr;
@@ -293,7 +293,7 @@ tty_term_strip(const char *s)
return (xstrdup(buf)); return (xstrdup(buf));
} }
void static void
tty_term_override(struct tty_term *term, const char *overrides) tty_term_override(struct tty_term *term, const char *overrides)
{ {
const struct tty_term_code_entry *ent; const struct tty_term_code_entry *ent;

69
tty.c
View File

@@ -31,31 +31,32 @@
#include "tmux.h" #include "tmux.h"
static int tty_log_fd = -1; static int tty_log_fd = -1;
void tty_read_callback(struct bufferevent *, void *); static void tty_read_callback(struct bufferevent *, void *);
void tty_error_callback(struct bufferevent *, short, 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 *); static void tty_set_italics(struct tty *);
int tty_try_colour(struct tty *, int, const char *); static int tty_try_colour(struct tty *, int, const char *);
void tty_colours(struct tty *, const struct grid_cell *); static void tty_colours(struct tty *, const struct grid_cell *);
void tty_check_fg(struct tty *, struct grid_cell *); static void tty_check_fg(struct tty *, struct grid_cell *);
void tty_check_bg(struct tty *, struct grid_cell *); static void tty_check_bg(struct tty *, struct grid_cell *);
void tty_colours_fg(struct tty *, const struct grid_cell *); static void tty_colours_fg(struct tty *, const struct grid_cell *);
void tty_colours_bg(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 *); static int tty_large_region(struct tty *, const struct tty_ctx *);
int tty_fake_bce(const struct tty *, const struct window_pane *); static int tty_fake_bce(const struct tty *, const struct window_pane *);
void tty_redraw_region(struct tty *, const struct tty_ctx *); static void tty_redraw_region(struct tty *, const struct tty_ctx *);
void tty_emulate_repeat(struct tty *, enum tty_code_code, enum tty_code_code, static void tty_emulate_repeat(struct tty *, enum tty_code_code,
u_int); enum tty_code_code, u_int);
void tty_repeat_space(struct tty *, u_int); static void tty_repeat_space(struct tty *, u_int);
void tty_cell(struct tty *, const struct grid_cell *, static void tty_cell(struct tty *, const struct grid_cell *,
const struct window_pane *); const struct window_pane *);
void tty_default_colours(struct grid_cell *, const struct window_pane *); static void tty_default_colours(struct grid_cell *,
const struct window_pane *);
#define tty_use_acs(tty) \ #define tty_use_acs(tty) \
(tty_term_has((tty)->term, TTYC_ACSC) && !((tty)->flags & TTY_UTF8)) (tty_term_has((tty)->term, TTYC_ACSC) && !((tty)->flags & TTY_UTF8))
@@ -173,7 +174,7 @@ tty_open(struct tty *tty, char **cause)
return (0); return (0);
} }
void static void
tty_read_callback(__unused struct bufferevent *bufev, void *data) tty_read_callback(__unused struct bufferevent *bufev, void *data)
{ {
struct tty *tty = 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, tty_error_callback(__unused struct bufferevent *bufev, __unused short what,
__unused void *data) __unused void *data)
{ {
@@ -450,7 +451,7 @@ tty_putn(struct tty *tty, const void *buf, size_t len, u_int width)
tty->cx += width; tty->cx += width;
} }
void static void
tty_set_italics(struct tty *tty) tty_set_italics(struct tty *tty)
{ {
const char *s; const char *s;
@@ -559,7 +560,7 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s)
tty->mode = mode; tty->mode = mode;
} }
void static void
tty_emulate_repeat(struct tty *tty, enum tty_code_code code, tty_emulate_repeat(struct tty *tty, enum tty_code_code code,
enum tty_code_code code1, u_int n) 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) tty_repeat_space(struct tty *tty, u_int n)
{ {
while (n-- > 0) 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 * probably several times now? Currently yes if it is more than 50% of the
* pane. * pane.
*/ */
int static int
tty_large_region(__unused struct tty *tty, const struct tty_ctx *ctx) tty_large_region(__unused struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; 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 * Return if BCE is needed but the terminal doesn't have it - it'll need to be
* emulated. * emulated.
*/ */
int static int
tty_fake_bce(const struct tty *tty, const struct window_pane *wp) tty_fake_bce(const struct tty *tty, const struct window_pane *wp)
{ {
struct grid_cell gc; 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 * CSR not supported, or window is a pane that doesn't take up the full
* width of the terminal. * width of the terminal.
*/ */
void static void
tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx) tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; 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); tty_cursor(tty, 0, 0);
} }
void static void
tty_cell(struct tty *tty, const struct grid_cell *gc, tty_cell(struct tty *tty, const struct grid_cell *gc,
const struct window_pane *wp) const struct window_pane *wp)
{ {
@@ -1419,7 +1420,7 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc,
tty_putcode(tty, TTYC_SMACS); tty_putcode(tty, TTYC_SMACS);
} }
void static void
tty_colours(struct tty *tty, const struct grid_cell *gc) tty_colours(struct tty *tty, const struct grid_cell *gc)
{ {
struct grid_cell *tc = &tty->cell; struct grid_cell *tc = &tty->cell;
@@ -1559,7 +1560,7 @@ tty_check_bg(struct tty *tty, struct grid_cell *gc)
gc->bg -= 90; gc->bg -= 90;
} }
void static void
tty_colours_fg(struct tty *tty, const struct grid_cell *gc) tty_colours_fg(struct tty *tty, const struct grid_cell *gc)
{ {
struct grid_cell *tc = &tty->cell; struct grid_cell *tc = &tty->cell;
@@ -1589,7 +1590,7 @@ save_fg:
tc->fg = gc->fg; tc->fg = gc->fg;
} }
void static void
tty_colours_bg(struct tty *tty, const struct grid_cell *gc) tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
{ {
struct grid_cell *tc = &tty->cell; struct grid_cell *tc = &tty->cell;
@@ -1619,7 +1620,7 @@ save_bg:
tc->bg = gc->bg; tc->bg = gc->bg;
} }
int static int
tty_try_colour(struct tty *tty, int colour, const char *type) tty_try_colour(struct tty *tty, int colour, const char *type)
{ {
u_char r, g, b; u_char r, g, b;
@@ -1672,7 +1673,7 @@ fallback_256:
return (0); return (0);
} }
void static void
tty_default_colours(struct grid_cell *gc, const struct window_pane *wp) tty_default_colours(struct grid_cell *gc, const struct window_pane *wp)
{ {
struct window *w = wp->window; struct window *w = wp->window;