Sync OpenBSD patchset 272:

options_get_number() is relatively expensive and a check for dead panes happens
a lot more often than actually finding one, so instead of getting the option
for every check, get it for every dead window found.
This commit is contained in:
Tiago Cunha 2009-08-20 11:40:15 +00:00
parent 36475f80e9
commit b644b17599

View File

@ -1,4 +1,4 @@
/* $Id: server.c,v 1.172 2009-08-19 09:04:48 nicm Exp $ */ /* $Id: server.c,v 1.173 2009-08-20 11:40:15 tcunha Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -1109,13 +1109,12 @@ void
server_check_window(struct window *w) server_check_window(struct window *w)
{ {
struct window_pane *wp, *wq; struct window_pane *wp, *wq;
struct options *oo = &w->options;
struct client *c; struct client *c;
struct session *s; struct session *s;
struct winlink *wl; struct winlink *wl;
u_int i, j; u_int i, j;
int destroyed, flag; int destroyed;
flag = options_get_number(&w->options, "remain-on-exit");
destroyed = 1; destroyed = 1;
@ -1128,7 +1127,7 @@ server_check_window(struct window *w)
* the window to be destroyed (or it'll close when the last * the window to be destroyed (or it'll close when the last
* pane dies). * pane dies).
*/ */
if (wp->fd == -1 && !flag) { if (wp->fd == -1 && options_get_number(oo, "remain-on-exit")) {
layout_close_pane(wp); layout_close_pane(wp);
window_remove_pane(w, wp); window_remove_pane(w, wp);
server_redraw_window(w); server_redraw_window(w);