mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.0523: loops are repeated
Problem: Loops are repeated. Solution: Use FOR_ALL_ macros. (Yegappan Lakshmanan, closes #5882)
This commit is contained in:
@@ -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))
|
||||
|
Reference in New Issue
Block a user