summaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-06-04 20:17:25 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-06-04 20:17:25 +0000
commitb044d0951f95ac38c13e37c4d6484895bf2c3ebe (patch)
tree67ee18795f03068857cfc0d12274e2ebd1f94d08 /window.c
parent879400e1f2d2d31c7ad733a6f43c424f89826209 (diff)
ifdef RB_PREV since 4.3 misses it too.
Diffstat (limited to 'window.c')
-rw-r--r--window.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/window.c b/window.c
index 63f2d5bf..637f6d8f 100644
--- a/window.c
+++ b/window.c
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.39 2008-06-04 17:54:27 nicm Exp $ */
+/* $Id: window.c,v 1.40 2008-06-04 20:17:25 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -141,7 +141,22 @@ winlink_next(unused struct winlinks *wwl, struct winlink *wl)
struct winlink *
winlink_previous(unused struct winlinks *wwl, struct winlink *wl)
{
+#ifdef RB_PREV
return (RB_PREV(winlinks, wwl, wl));
+#else
+ struct winlink *wk;
+ int idx = wl->idx;
+
+ wk = NULL;
+ wl = RB_MIN(winlinks, wwl);
+ while (wl != NULL && wl->idx < idx) {
+ wk = wl;
+ wl = RB_NEXT(winlinks, wwl, wl);
+ }
+ if (wl == NULL)
+ return (NULL);
+ return (wk);
+#endif
}
struct window *