summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 820115754..a657e7242 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -52,6 +52,9 @@ static void clear_wininfo(buf_T *buf);
# define dev_T unsigned
#endif
+#define FOR_ALL_BUFS_FROM_LAST(buf) \
+ for ((buf) = lastbuf; (buf) != NULL; (buf) = (buf)->b_prev)
+
#if defined(FEAT_QUICKFIX)
static char *msg_loclist = N_("[Location List]");
static char *msg_qflist = N_("[Quickfix List]");
@@ -415,7 +418,7 @@ buf_valid(buf_T *buf)
// Assume that we more often have a recent buffer, start with the last
// one.
- for (bp = lastbuf; bp != NULL; bp = bp->b_prev)
+ FOR_ALL_BUFS_FROM_LAST(bp)
if (bp == buf)
return TRUE;
return FALSE;
@@ -2510,7 +2513,7 @@ buflist_findname_stat(
buf_T *buf;
// Start at the last buffer, expect to find a match sooner.
- for (buf = lastbuf; buf != NULL; buf = buf->b_prev)
+ FOR_ALL_BUFS_FROM_LAST(buf)
if ((buf->b_flags & BF_DUMMY) == 0 && !otherfile_buf(buf, ffname
#ifdef UNIX
, stp
@@ -2593,7 +2596,7 @@ buflist_findpat(
return -1;
}
- for (buf = lastbuf; buf != NULL; buf = buf->b_prev)
+ FOR_ALL_BUFS_FROM_LAST(buf)
if (buf->b_p_bl == find_listed
#ifdef FEAT_DIFF
&& (!diffmode || diff_mode_buf(buf))