mirror of
https://github.com/tmux/tmux.git
synced 2025-01-13 03:48:51 +00:00
There is no real need for window_printable_flags to allocate, make it
return a buffer from the stack.
This commit is contained in:
parent
0b44ad99b5
commit
0f25ad3ca3
7
format.c
7
format.c
@ -1237,17 +1237,14 @@ format_defaults_winlink(struct format_tree *ft, struct session *s,
|
|||||||
struct winlink *wl)
|
struct winlink *wl)
|
||||||
{
|
{
|
||||||
struct window *w = wl->window;
|
struct window *w = wl->window;
|
||||||
char *flags;
|
|
||||||
|
|
||||||
if (ft->w == NULL)
|
if (ft->w == NULL)
|
||||||
ft->w = wl->window;
|
ft->w = wl->window;
|
||||||
|
|
||||||
flags = window_printable_flags(s, wl);
|
|
||||||
|
|
||||||
format_defaults_window(ft, w);
|
format_defaults_window(ft, w);
|
||||||
|
|
||||||
format_add(ft, "window_index", "%d", wl->idx);
|
format_add(ft, "window_index", "%d", wl->idx);
|
||||||
format_add(ft, "window_flags", "%s", flags);
|
format_add(ft, "window_flags", "%s", window_printable_flags(s, wl));
|
||||||
format_add(ft, "window_active", "%d", wl == s->curw);
|
format_add(ft, "window_active", "%d", wl == s->curw);
|
||||||
|
|
||||||
format_add(ft, "window_bell_flag", "%d",
|
format_add(ft, "window_bell_flag", "%d",
|
||||||
@ -1259,8 +1256,6 @@ format_defaults_winlink(struct format_tree *ft, struct session *s,
|
|||||||
format_add(ft, "window_last_flag", "%d",
|
format_add(ft, "window_last_flag", "%d",
|
||||||
!!(wl == TAILQ_FIRST(&s->lastw)));
|
!!(wl == TAILQ_FIRST(&s->lastw)));
|
||||||
format_add(ft, "window_linked", "%d", session_is_linked(s, wl->window));
|
format_add(ft, "window_linked", "%d", session_is_linked(s, wl->window));
|
||||||
|
|
||||||
free(flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set default format keys for a window pane. */
|
/* Set default format keys for a window pane. */
|
||||||
|
2
tmux.h
2
tmux.h
@ -2120,7 +2120,7 @@ int window_pane_outside(struct window_pane *);
|
|||||||
int window_pane_visible(struct window_pane *);
|
int window_pane_visible(struct window_pane *);
|
||||||
char *window_pane_search(struct window_pane *, const char *,
|
char *window_pane_search(struct window_pane *, const char *,
|
||||||
u_int *);
|
u_int *);
|
||||||
char *window_printable_flags(struct session *, struct winlink *);
|
const char *window_printable_flags(struct session *, struct winlink *);
|
||||||
struct window_pane *window_pane_find_up(struct window_pane *);
|
struct window_pane *window_pane_find_up(struct window_pane *);
|
||||||
struct window_pane *window_pane_find_down(struct window_pane *);
|
struct window_pane *window_pane_find_down(struct window_pane *);
|
||||||
struct window_pane *window_pane_find_left(struct window_pane *);
|
struct window_pane *window_pane_find_left(struct window_pane *);
|
||||||
|
6
window.c
6
window.c
@ -710,10 +710,10 @@ window_destroy_panes(struct window *w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Retuns the printable flags on a window, empty string if no flags set. */
|
/* Retuns the printable flags on a window, empty string if no flags set. */
|
||||||
char *
|
const char *
|
||||||
window_printable_flags(struct session *s, struct winlink *wl)
|
window_printable_flags(struct session *s, struct winlink *wl)
|
||||||
{
|
{
|
||||||
char flags[32];
|
static char flags[32];
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
@ -732,7 +732,7 @@ window_printable_flags(struct session *s, struct winlink *wl)
|
|||||||
if (wl->window->flags & WINDOW_ZOOMED)
|
if (wl->window->flags & WINDOW_ZOOMED)
|
||||||
flags[pos++] = 'Z';
|
flags[pos++] = 'Z';
|
||||||
flags[pos] = '\0';
|
flags[pos] = '\0';
|
||||||
return (xstrdup(flags));
|
return (flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct window_pane *
|
struct window_pane *
|
||||||
|
Loading…
Reference in New Issue
Block a user