From e0f26dcda36dc35741da6047a11efb853b3137d9 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 8 Dec 2015 08:34:18 +0000 Subject: [PATCH] Remove format_create_flags and just pass flags to format_create. --- cmd-attach-session.c | 2 +- cmd-break-pane.c | 2 +- cmd-display-message.c | 2 +- cmd-if-shell.c | 2 +- cmd-list-buffers.c | 2 +- cmd-list-clients.c | 2 +- cmd-list-panes.c | 2 +- cmd-list-sessions.c | 2 +- cmd-list-windows.c | 2 +- cmd-new-session.c | 4 ++-- cmd-new-window.c | 4 ++-- cmd-pipe-pane.c | 2 +- cmd-run-shell.c | 2 +- cmd-split-window.c | 4 ++-- control-notify.c | 2 +- format.c | 9 +-------- names.c | 2 +- server-client.c | 2 +- status.c | 8 ++++---- tmux.h | 3 +-- window-choose.c | 2 +- window-copy.c | 2 +- 22 files changed, 28 insertions(+), 36 deletions(-) diff --git a/cmd-attach-session.c b/cmd-attach-session.c index 45b05b09..dd953ebd 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -93,7 +93,7 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag, } if (cflag != NULL) { - ft = format_create(); + ft = format_create(0); format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, NULL, NULL); cwd = format_expand(ft, cflag); diff --git a/cmd-break-pane.c b/cmd-break-pane.c index 707cd09b..75ae9044 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -101,7 +101,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) if ((template = args_get(args, 'F')) == NULL) template = BREAK_PANE_TEMPLATE; - ft = format_create(); + ft = format_create(0); format_defaults(ft, cmd_find_client(cmdq, NULL, 1), dst_s, wl, wp); diff --git a/cmd-display-message.c b/cmd-display-message.c index 1f9f40fa..2fb76caa 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -88,7 +88,7 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq) if (template == NULL) template = DISPLAY_MESSAGE_TEMPLATE; - ft = format_create(); + ft = format_create(0); format_defaults(ft, c, s, wl, wp); msg = format_expand_time(ft, template, time(NULL)); diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 47f259e7..9907a764 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -86,7 +86,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) cwd = NULL; } - ft = format_create(); + ft = format_create(0); format_defaults(ft, NULL, s, wl, wp); shellcmd = format_expand(ft, args->argv[0]); format_free(ft); diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c index a0036032..a95cc336 100644 --- a/cmd-list-buffers.c +++ b/cmd-list-buffers.c @@ -54,7 +54,7 @@ cmd_list_buffers_exec(struct cmd *self, struct cmd_q *cmdq) pb = NULL; while ((pb = paste_walk(pb)) != NULL) { - ft = format_create(); + ft = format_create(0); format_defaults_paste_buffer(ft, pb); line = format_expand(ft, template); diff --git a/cmd-list-clients.c b/cmd-list-clients.c index 372b5283..2bde6b32 100644 --- a/cmd-list-clients.c +++ b/cmd-list-clients.c @@ -69,7 +69,7 @@ cmd_list_clients_exec(struct cmd *self, struct cmd_q *cmdq) if (c->session == NULL || (s != NULL && s != c->session)) continue; - ft = format_create(); + ft = format_create(0); format_add(ft, "line", "%u", idx); format_defaults(ft, c, NULL, NULL, NULL); diff --git a/cmd-list-panes.c b/cmd-list-panes.c index 0af391c5..14ee7064 100644 --- a/cmd-list-panes.c +++ b/cmd-list-panes.c @@ -125,7 +125,7 @@ cmd_list_panes_window(struct cmd *self, struct session *s, struct winlink *wl, n = 0; TAILQ_FOREACH(wp, &wl->window->panes, entry) { - ft = format_create(); + ft = format_create(0); format_add(ft, "line", "%u", n); format_defaults(ft, NULL, s, wl, wp); diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c index 49ef9467..099b4f2e 100644 --- a/cmd-list-sessions.c +++ b/cmd-list-sessions.c @@ -61,7 +61,7 @@ cmd_list_sessions_exec(struct cmd *self, struct cmd_q *cmdq) n = 0; RB_FOREACH(s, sessions, &sessions) { - ft = format_create(); + ft = format_create(0); format_add(ft, "line", "%u", n); format_defaults(ft, NULL, s, NULL, NULL); diff --git a/cmd-list-windows.c b/cmd-list-windows.c index 3f6b2a4c..958380e2 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -105,7 +105,7 @@ cmd_list_windows_session( n = 0; RB_FOREACH(wl, winlinks, &s->windows) { - ft = format_create(); + ft = format_create(0); format_add(ft, "line", "%u", n); format_defaults(ft, NULL, s, wl, NULL); diff --git a/cmd-new-session.c b/cmd-new-session.c index 65dc6cf5..52e24ae6 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -119,7 +119,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) /* Get the new session working directory. */ to_free = NULL; if (args_has(args, 'c')) { - ft = format_create(); + ft = format_create(0); format_defaults(ft, cmd_find_client(cmdq, NULL, 1), NULL, NULL, NULL); to_free = cwd = format_expand(ft, args_get(args, 'c')); @@ -283,7 +283,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) if ((template = args_get(args, 'F')) == NULL) template = NEW_SESSION_TEMPLATE; - ft = format_create(); + ft = format_create(0); format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, NULL, NULL); diff --git a/cmd-new-window.c b/cmd-new-window.c index 24204746..0865a9bc 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -94,7 +94,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq) to_free = NULL; if (args_has(args, 'c')) { - ft = format_create(); + ft = format_create(0); format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, NULL, NULL); cwd = to_free = format_expand(ft, args_get(args, 'c')); @@ -143,7 +143,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq) if ((template = args_get(args, 'F')) == NULL) template = NEW_WINDOW_TEMPLATE; - ft = format_create(); + ft = format_create(0); format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, wl, NULL); diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index 87c802b9..1577c252 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -89,7 +89,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq) } /* Expand the command. */ - ft = format_create(); + ft = format_create(0); format_defaults(ft, c, s, wl, wp); cmd = format_expand_time(ft, args->argv[0], time(NULL)); format_free(ft); diff --git a/cmd-run-shell.c b/cmd-run-shell.c index def3ef01..a381fb91 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -100,7 +100,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq) cwd = NULL; } - ft = format_create(); + ft = format_create(0); format_defaults(ft, NULL, s, wl, wp); shellcmd = format_expand(ft, args->argv[0]); format_free(ft); diff --git a/cmd-split-window.c b/cmd-split-window.c index fb766d3b..859e1559 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -88,7 +88,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) to_free = NULL; if (args_has(args, 'c')) { - ft = format_create(); + ft = format_create(0); format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, NULL, NULL); to_free = cwd = format_expand(ft, args_get(args, 'c')); @@ -165,7 +165,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) if ((template = args_get(args, 'F')) == NULL) template = SPLIT_WINDOW_TEMPLATE; - ft = format_create(); + ft = format_create(0); format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, wl, new_wp); diff --git a/control-notify.c b/control-notify.c index db3648a4..7036f6b5 100644 --- a/control-notify.c +++ b/control-notify.c @@ -88,7 +88,7 @@ control_notify_window_layout_changed(struct window *w) if (w->layout_root == NULL) continue; - ft = format_create(); + ft = format_create(0); wl = winlink_find_by_window(&s->windows, w); if (wl != NULL) { format_defaults(ft, c, NULL, wl, NULL); diff --git a/format.c b/format.c index bafd8ce6..61a911ed 100644 --- a/format.c +++ b/format.c @@ -465,14 +465,7 @@ format_cb_pane_tabs(struct format_tree *ft, struct format_entry *fe) /* Create a new tree. */ struct format_tree * -format_create(void) -{ - return (format_create_flags(0)); -} - -/* Create a new tree for the status line. */ -struct format_tree * -format_create_flags(int flags) +format_create(int flags) { struct format_tree *ft; diff --git a/names.c b/names.c index 7d956db3..268403e7 100644 --- a/names.c +++ b/names.c @@ -118,7 +118,7 @@ format_window_name(struct window *w) struct format_tree *ft; char *fmt, *name; - ft = format_create(); + ft = format_create(0); format_defaults_window(ft, w); format_defaults_pane(ft, w->active); diff --git a/server-client.c b/server-client.c index c948e980..92ce024d 100644 --- a/server-client.c +++ b/server-client.c @@ -933,7 +933,7 @@ server_client_set_title(struct client *c) template = options_get_string(s->options, "set-titles-string"); - ft = format_create(); + ft = format_create(0); format_defaults(ft, c, NULL, NULL, NULL); title = format_expand_time(ft, template, time(NULL)); diff --git a/status.c b/status.c index d05376c0..5539fa31 100644 --- a/status.c +++ b/status.c @@ -500,9 +500,9 @@ status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t) return (xstrdup("")); if (c->flags & CLIENT_STATUSFORCE) - ft = format_create_flags(FORMAT_STATUS|FORMAT_FORCE); + ft = format_create(FORMAT_STATUS|FORMAT_FORCE); else - ft = format_create_flags(FORMAT_STATUS); + ft = format_create(FORMAT_STATUS); format_defaults(ft, c, NULL, wl, NULL); expanded = format_expand_time(ft, fmt, t); @@ -661,7 +661,7 @@ status_prompt_set(struct client *c, const char *msg, const char *input, int keys; time_t t; - ft = format_create(); + ft = format_create(0); format_defaults(ft, c, NULL, NULL, NULL); t = time(NULL); @@ -722,7 +722,7 @@ status_prompt_update(struct client *c, const char *msg, const char *input) struct format_tree *ft; time_t t; - ft = format_create(); + ft = format_create(0); format_defaults(ft, c, NULL, NULL, NULL); t = time(NULL); diff --git a/tmux.h b/tmux.h index 7757f12f..5df72052 100644 --- a/tmux.h +++ b/tmux.h @@ -1492,8 +1492,7 @@ char *paste_make_sample(struct paste_buffer *); #define FORMAT_STATUS 0x1 #define FORMAT_FORCE 0x2 struct format_tree; -struct format_tree *format_create(void); -struct format_tree *format_create_flags(int); +struct format_tree *format_create(int); void format_free(struct format_tree *); void printflike(3, 4) format_add(struct format_tree *, const char *, const char *, ...); diff --git a/window-choose.c b/window-choose.c index cab3e5d8..862531fb 100644 --- a/window-choose.c +++ b/window-choose.c @@ -186,7 +186,7 @@ window_choose_data_create(int type, struct client *c, struct session *s) wcd = xmalloc(sizeof *wcd); wcd->type = type; - wcd->ft = format_create(); + wcd->ft = format_create(0); wcd->ft_template = NULL; wcd->command = NULL; diff --git a/window-copy.c b/window-copy.c index 37025302..eb17460d 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1480,7 +1480,7 @@ window_copy_copy_pipe(struct window_pane *wp, struct session *sess, if (buf == NULL) return; - ft = format_create(); + ft = format_create(0); format_defaults(ft, NULL, sess, NULL, wp); expanded = format_expand(ft, arg);