patch 7.4.2101
Problem: Looping over windows, buffers and tab pages is inconsistant.
Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan)
diff --git a/src/fileio.c b/src/fileio.c
index ea01b76..c406617 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6088,7 +6088,7 @@
char_u *p;
mch_dirname(dirname, MAXPATHL);
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ FOR_ALL_BUFFERS(buf)
{
if (buf->b_fname != NULL
#ifdef FEAT_QUICKFIX
@@ -6680,7 +6680,7 @@
++no_wait_return;
did_check_timestamps = TRUE;
already_warned = FALSE;
- for (buf = firstbuf; buf != NULL; )
+ FOR_ALL_BUFFERS(buf)
{
/* Only check buffers in a window. */
if (buf->b_nwindows > 0)
@@ -6699,7 +6699,6 @@
continue;
}
}
- buf = buf->b_next;
}
--no_wait_return;
need_check_timestamps = FALSE;
@@ -8759,7 +8758,7 @@
* gives problems when the autocommands make changes to the list of
* buffers or windows...
*/
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ FOR_ALL_BUFFERS(buf)
{
if (buf->b_ml.ml_mfp != NULL)
{
@@ -8831,7 +8830,7 @@
win = curwin;
else
#ifdef FEAT_WINDOWS
- for (win = firstwin; win != NULL; win = win->w_next)
+ FOR_ALL_WINDOWS(win)
if (win->w_buffer == buf)
break;
#else