diff src/fileio.c @ 9649:fd9727ae3c49 v7.4.2101

commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 24 22:04:11 2016 +0200 patch 7.4.2101 Problem: Looping over windows, buffers and tab pages is inconsistant. Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Jul 2016 22:15:07 +0200
parents 42a8a81decdf
children 01c9630e80e0
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6088,7 +6088,7 @@ shorten_fnames(int force)
     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 @@ check_timestamps(
 	++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 @@ check_timestamps(
 		    continue;
 		}
 	    }
-	    buf = buf->b_next;
 	}
 	--no_wait_return;
 	need_check_timestamps = FALSE;
@@ -8759,7 +8758,7 @@ ex_doautoall(exarg_T *eap)
      * 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 @@ aucmd_prepbuf(
 	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