diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-01-13 02:07:07 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-01-13 02:07:07 +0000 |
commit | c91e4f90b2b4e1349d3b870b11153e41ae6b8455 (patch) | |
tree | 92ace279aced4c091579a4ec4a809d5863221848 /usr.bin/tmux | |
parent | 53f195ed70cacdcd85f9689822178a7eac624145 (diff) |
Fix next and previous session functions to actually work.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/session.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c index 31bdc553e3a..72921d1d131 100644 --- a/usr.bin/tmux/session.c +++ b/usr.bin/tmux/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.27 2011/01/01 01:12:09 nicm Exp $ */ +/* $OpenBSD: session.c,v 1.28 2011/01/13 02:07:06 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -181,12 +181,9 @@ session_next_session(struct session *s) if (RB_EMPTY(&sessions) || !session_alive(s)) return (NULL); - s2 = s; - do { - s2 = RB_NEXT(sessions, &sessions, s2); - if (s2 == NULL) - s2 = RB_MIN(sessions, &sessions); - } while (s2 != s); + s2 = RB_NEXT(sessions, &sessions, s2); + if (s2 == NULL) + s2 = RB_MIN(sessions, &sessions); if (s2 == s) return (NULL); return (s2); @@ -201,12 +198,9 @@ session_previous_session(struct session *s) if (RB_EMPTY(&sessions) || !session_alive(s)) return (NULL); - s2 = s; - do { - s2 = RB_PREV(sessions, &sessions, s2); - if (s2 == NULL) - s2 = RB_MAX(sessions, &sessions); - } while (s2 != s); + s2 = RB_PREV(sessions, &sessions, s2); + if (s2 == NULL) + s2 = RB_MAX(sessions, &sessions); if (s2 == s) return (NULL); return (s2); |