From 9418efdb81c2c661fe1b3fd21196468414472fe3 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 20 Apr 2017 09:43:45 +0000 Subject: [PATCH] Now that struct winlink has a session pointer, can remove some arguments. --- usr.bin/tmux/format.c | 14 +++++++------- usr.bin/tmux/tmux.h | 4 ++-- usr.bin/tmux/window.c | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 052d481ef08..525cfc105a3 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.128 2017/04/20 09:39:07 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.129 2017/04/20 09:43:45 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -71,7 +71,7 @@ static int format_replace(struct format_tree *, const char *, size_t, static void format_defaults_session(struct format_tree *, struct session *); static void format_defaults_client(struct format_tree *, struct client *); -static void format_defaults_winlink(struct format_tree *, struct session *, +static void format_defaults_winlink(struct format_tree *, struct winlink *); /* Entry in format job tree. */ @@ -1121,8 +1121,8 @@ format_defaults(struct format_tree *ft, struct client *c, struct session *s, format_defaults_client(ft, c); if (s != NULL) format_defaults_session(ft, s); - if (s != NULL && wl != NULL) - format_defaults_winlink(ft, s, wl); + if (wl != NULL) + format_defaults_winlink(ft, wl); if (wp != NULL) format_defaults_pane(ft, wp); } @@ -1233,9 +1233,9 @@ format_defaults_window(struct format_tree *ft, struct window *w) /* Set default format keys for a winlink. */ static void -format_defaults_winlink(struct format_tree *ft, struct session *s, - struct winlink *wl) +format_defaults_winlink(struct format_tree *ft, struct winlink *wl) { + struct session *s = wl->session; struct window *w = wl->window; if (ft->w == NULL) @@ -1244,7 +1244,7 @@ format_defaults_winlink(struct format_tree *ft, struct session *s, format_defaults_window(ft, w); format_add(ft, "window_index", "%d", wl->idx); - format_add(ft, "window_flags", "%s", window_printable_flags(s, wl)); + format_add(ft, "window_flags", "%s", window_printable_flags(wl)); format_add(ft, "window_active", "%d", wl == s->curw); format_add(ft, "window_bell_flag", "%d", diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index c74badd0c63..939e5ad3203 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.742 2017/04/20 09:39:07 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.743 2017/04/20 09:43:45 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2120,7 +2120,7 @@ int window_pane_outside(struct window_pane *); int window_pane_visible(struct window_pane *); char *window_pane_search(struct window_pane *, const char *, u_int *); -const char *window_printable_flags(struct session *, struct winlink *); +const char *window_printable_flags(struct winlink *); 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_left(struct window_pane *); diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index 1e9bdd422a8..5ec2613f67e 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.188 2017/04/20 09:39:07 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.189 2017/04/20 09:43:45 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -709,12 +709,12 @@ window_destroy_panes(struct window *w) } } -/* Retuns the printable flags on a window, empty string if no flags set. */ const char * -window_printable_flags(struct session *s, struct winlink *wl) +window_printable_flags(struct winlink *wl) { - static char flags[32]; - int pos; + struct session *s = wl->session; + static char flags[32]; + int pos; pos = 0; if (wl->flags & WINLINK_ACTIVITY) -- 2.20.1