Skip to content

Commit

Permalink
Add static in window-*.c and move some internal functions out of tmux.h.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicm committed Oct 11, 2016
1 parent 85d7afa commit e454018
Show file tree
Hide file tree
Showing 13 changed files with 235 additions and 239 deletions.
27 changes: 2 additions & 25 deletions arguments.c
Expand Up @@ -35,6 +35,7 @@ struct args_entry {
RB_ENTRY(args_entry) entry;
};

static void args_set(struct args *, u_char, const char *);
static struct args_entry *args_find(struct args *, u_char);

static int args_cmp(struct args_entry *, struct args_entry *);
Expand All @@ -47,30 +48,6 @@ args_cmp(struct args_entry *a1, struct args_entry *a2)
return (a1->flag - a2->flag);
}

/* Create an arguments set with no flags. */
struct args *
args_create(int argc, ...)
{
struct args *args;
va_list ap;
int i;

args = xcalloc(1, sizeof *args);

args->argc = argc;
if (argc == 0)
args->argv = NULL;
else
args->argv = xcalloc(argc, sizeof *args->argv);

va_start(ap, argc);
for (i = 0; i < argc; i++)
args->argv[i] = xstrdup(va_arg(ap, char *));
va_end(ap);

return (args);
}

/* Find a flag in the arguments tree. */
static struct args_entry *
args_find(struct args *args, u_char ch)
Expand Down Expand Up @@ -206,7 +183,7 @@ args_has(struct args *args, u_char ch)
}

/* Set argument value in the arguments tree. */
void
static void
args_set(struct args *args, u_char ch, const char *value)
{
struct args_entry *entry;
Expand Down
3 changes: 2 additions & 1 deletion cmd-queue.c
Expand Up @@ -26,6 +26,7 @@
#include "tmux.h"

static enum cmd_retval cmdq_continue_one(struct cmd_q *);
static void cmdq_flush(struct cmd_q *);

/* Create new command queue. */
struct cmd_q *
Expand Down Expand Up @@ -319,7 +320,7 @@ cmdq_continue(struct cmd_q *cmdq)
}

/* Flush command queue. */
void
static void
cmdq_flush(struct cmd_q *cmdq)
{
struct cmd_q_item *item, *item1;
Expand Down
5 changes: 4 additions & 1 deletion grid.c
Expand Up @@ -43,13 +43,16 @@ const struct grid_cell_entry grid_default_entry = {
0, { .data = { 0, 8, 8, ' ' } }
};

static void grid_expand_line(struct grid *, u_int, u_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 *,
Expand Down Expand Up @@ -243,7 +246,7 @@ grid_scroll_history_region(struct grid *gd, u_int upper, u_int lower)
}

/* Expand line to fit to cell. */
void
static void
grid_expand_line(struct grid *gd, u_int py, u_int sx)
{
struct grid_line *gl;
Expand Down
8 changes: 5 additions & 3 deletions names.c
Expand Up @@ -25,8 +25,10 @@

#include "tmux.h"

static void name_time_callback(int, short, void *);
static 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 *);

static char *format_window_name(struct window *);

static void
name_time_callback(__unused int fd, __unused short events, void *arg)
Expand Down Expand Up @@ -115,7 +117,7 @@ default_window_name(struct window *w)
return (s);
}

char *
static char *
format_window_name(struct window *w)
{
struct format_tree *ft;
Expand Down
4 changes: 3 additions & 1 deletion screen.c
Expand Up @@ -27,6 +27,8 @@
static void screen_resize_x(struct screen *, u_int);
static void screen_resize_y(struct screen *, u_int);

static void screen_reflow(struct screen *, u_int);

/* Create a new screen. */
void
screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit)
Expand Down Expand Up @@ -370,7 +372,7 @@ screen_check_selection(struct screen *s, u_int px, u_int py)
}

/* Reflow wrapped lines. */
void
static void
screen_reflow(struct screen *s, u_int new_x)
{
struct grid *old = s->grid;
Expand Down
3 changes: 2 additions & 1 deletion server-fn.c
Expand Up @@ -30,6 +30,7 @@

static struct session *server_next_session(struct session *);
static void server_callback_identify(int, short, void *);
static void server_destroy_session_group(struct session *);

void
server_fill_environ(struct session *s, struct environ *env)
Expand Down Expand Up @@ -339,7 +340,7 @@ server_destroy_pane(struct window_pane *wp, int hooks)
server_redraw_window(w);
}

void
static void
server_destroy_session_group(struct session *s)
{
struct session_group *sg;
Expand Down
10 changes: 7 additions & 3 deletions session.c
Expand Up @@ -38,6 +38,10 @@ static void session_lock_timer(int, short, void *);
static struct winlink *session_next_alert(struct winlink *);
static struct winlink *session_previous_alert(struct winlink *);

static void session_group_remove(struct session *);
static u_int session_group_count(struct session_group *);
static void session_group_synchronize1(struct session *, struct session *);

RB_GENERATE(sessions, session, entry, session_cmp);

int
Expand Down Expand Up @@ -582,7 +586,7 @@ session_group_add(struct session *target, struct session *s)
}

/* Remove a session from its group and destroy the group if empty. */
void
static void
session_group_remove(struct session *s)
{
struct session_group *sg;
Expand All @@ -599,7 +603,7 @@ session_group_remove(struct session *s)
}

/* Count number of sessions in session group. */
u_int
static u_int
session_group_count(struct session_group *sg)
{
struct session *s;
Expand Down Expand Up @@ -650,7 +654,7 @@ session_group_synchronize_from(struct session *target)
* winlinks then recreating them, then updating the current window, last window
* stack and alerts.
*/
void
static void
session_group_synchronize1(struct session *target, struct session *s)
{
struct winlinks old_windows, *ww;
Expand Down
7 changes: 5 additions & 2 deletions tmux.c
Expand Up @@ -47,6 +47,9 @@ const char *socket_path;
static __dead void usage(void);
static char *make_label(const char *);

static const char *getshell(void);
static int checkshell(const char *);

static __dead void
usage(void)
{
Expand All @@ -57,7 +60,7 @@ usage(void)
exit(1);
}

const char *
static const char *
getshell(void)
{
struct passwd *pw;
Expand All @@ -74,7 +77,7 @@ getshell(void)
return (_PATH_BSHELL);
}

int
static int
checkshell(const char *shell)
{
if (shell == NULL || *shell == '\0' || *shell != '/')
Expand Down
21 changes: 0 additions & 21 deletions tmux.h
Expand Up @@ -1520,8 +1520,6 @@ extern struct options *global_w_options;
extern struct environ *global_environ;
extern struct timeval start_time;
extern const char *socket_path;
const char *getshell(void);
int checkshell(const char *);
int areshell(const char *);
void setblocking(int, int);
const char *find_home(void);
Expand Down Expand Up @@ -1681,14 +1679,11 @@ void environ_log(struct environ *, const char *);

/* tty.c */
void tty_create_log(void);
void tty_init_termios(int, struct termios *, struct bufferevent *);
void tty_raw(struct tty *, const char *);
void tty_attributes(struct tty *, const struct grid_cell *,
const struct window_pane *);
void tty_reset(struct tty *);
void tty_region_pane(struct tty *, const struct tty_ctx *, u_int, u_int);
void tty_region(struct tty *, u_int, u_int);
void tty_cursor_pane(struct tty *, const struct tty_ctx *, u_int, u_int);
void tty_cursor(struct tty *, u_int, u_int);
void tty_putcode(struct tty *, enum tty_code_code);
void tty_putcode1(struct tty *, enum tty_code_code, int);
Expand All @@ -1706,7 +1701,6 @@ void tty_start_tty(struct tty *);
void tty_stop_tty(struct tty *);
void tty_set_title(struct tty *, const char *);
void tty_update_mode(struct tty *, int, struct screen *);
void tty_force_cursor_colour(struct tty *, const char *);
void tty_draw_pane(struct tty *, const struct window_pane *, u_int, u_int,
u_int);
void tty_draw_line(struct tty *, const struct window_pane *, struct screen *,
Expand Down Expand Up @@ -1763,12 +1757,10 @@ void tty_keys_free(struct tty *);
key_code tty_keys_next(struct tty *);

/* arguments.c */
struct args *args_create(int, ...);
struct args *args_parse(const char *, int, char **);
void args_free(struct args *);
char *args_print(struct args *);
int args_has(struct args *, u_char);
void args_set(struct args *, u_char, const char *);
const char *args_get(struct args *, u_char);
long long args_strtonum(struct args *, u_char, long long, long long,
char **);
Expand Down Expand Up @@ -1832,7 +1824,6 @@ void cmdq_run(struct cmd_q *, struct cmd_list *,
void cmdq_append(struct cmd_q *, struct cmd_list *,
struct mouse_event *);
int cmdq_continue(struct cmd_q *);
void cmdq_flush(struct cmd_q *);

/* cmd-string.c */
int cmd_string_parse(const char *, struct cmd_list **, const char *,
Expand Down Expand Up @@ -1916,7 +1907,6 @@ int server_link_window(struct session *,
struct winlink *, struct session *, int, int, int, char **);
void server_unlink_window(struct session *, struct winlink *);
void server_destroy_pane(struct window_pane *, int);
void server_destroy_session_group(struct session *);
void server_destroy_session(struct session *);
void server_check_unattached(void);
void server_set_identify(struct client *);
Expand Down Expand Up @@ -1982,7 +1972,6 @@ void grid_collect_history(struct grid *);
void grid_scroll_history(struct grid *);
void grid_scroll_history_region(struct grid *, u_int, u_int);
void grid_clear_history(struct grid *);
void grid_expand_line(struct grid *, u_int, u_int);
const struct grid_line *grid_peek_line(struct grid *, u_int);
void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *);
Expand Down Expand Up @@ -2078,7 +2067,6 @@ void screen_set_selection(struct screen *,
u_int, u_int, u_int, u_int, u_int, struct grid_cell *);
void screen_clear_selection(struct screen *);
int screen_check_selection(struct screen *, u_int, u_int);
void screen_reflow(struct screen *, u_int);

/* window.c */
extern struct windows windows;
Expand All @@ -2092,7 +2080,6 @@ RB_PROTOTYPE(window_pane_tree, window_pane, tree_entry, window_pane_cmp);
struct winlink *winlink_find_by_index(struct winlinks *, int);
struct winlink *winlink_find_by_window(struct winlinks *, struct window *);
struct winlink *winlink_find_by_window_id(struct winlinks *, u_int);
int winlink_next_index(struct winlinks *, int);
u_int winlink_count(struct winlinks *);
struct winlink *winlink_add(struct winlinks *, int);
void winlink_set_window(struct winlink *, struct window *);
Expand Down Expand Up @@ -2136,8 +2123,6 @@ u_int window_count_panes(struct window *);
void window_destroy_panes(struct window *);
struct window_pane *window_pane_find_by_id_str(const char *);
struct window_pane *window_pane_find_by_id(u_int);
struct window_pane *window_pane_create(struct window *, u_int, u_int, u_int);
void window_pane_destroy(struct window_pane *);
int window_pane_spawn(struct window_pane *, int, char **,
const char *, const char *, const char *, struct environ *,
struct termios *, char **);
Expand Down Expand Up @@ -2223,7 +2208,6 @@ void window_choose_ready(struct window_pane *,
u_int, void (*)(struct window_choose_data *));
struct window_choose_data *window_choose_data_create (int,
struct client *, struct session *);
void window_choose_data_free(struct window_choose_data *);
void window_choose_data_run(struct window_choose_data *);
struct window_choose_data *window_choose_add_window(struct window_pane *,
struct client *, struct session *, struct winlink *,
Expand All @@ -2232,13 +2216,11 @@ struct window_choose_data *window_choose_add_session(struct window_pane *,
struct client *, struct session *, const char *,
const char *, u_int);
void window_choose_expand_all(struct window_pane *);
void window_choose_collapse_all(struct window_pane *);
void window_choose_set_current(struct window_pane *, u_int);

/* names.c */
void check_window_name(struct window *);
char *default_window_name(struct window *);
char *format_window_name(struct window *);
char *parse_window_name(const char *);

/* signal.c */
Expand Down Expand Up @@ -2295,11 +2277,8 @@ int session_set_current(struct session *, struct winlink *);
struct session_group *session_group_find(struct session *);
u_int session_group_index(struct session_group *);
void session_group_add(struct session *, struct session *);
void session_group_remove(struct session *);
u_int session_group_count(struct session_group *);
void session_group_synchronize_to(struct session *);
void session_group_synchronize_from(struct session *);
void session_group_synchronize1(struct session *, struct session *);
void session_renumber_windows(struct session *);

/* utf8.c */
Expand Down

0 comments on commit e454018

Please sign in to comment.