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/main.c b/src/main.c
index ff82a9f..926b8ab 100644
--- a/src/main.c
+++ b/src/main.c
@@ -742,7 +742,7 @@
win_T *wp;
/* set options in each window for "vimdiff". */
- for (wp = firstwin; wp != NULL; wp = wp->w_next)
+ FOR_ALL_WINDOWS(wp)
diff_win_options(wp, TRUE);
}
#endif
@@ -1375,8 +1375,7 @@
for (tp = first_tabpage; tp != NULL; tp = next_tp)
{
next_tp = tp->tp_next;
- for (wp = (tp == curtab)
- ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next)
+ FOR_ALL_WINDOWS_IN_TAB(tp, wp)
{
if (wp->w_buffer == NULL)
/* Autocmd must have close the buffer already, skip. */
@@ -1399,7 +1398,7 @@
# endif
/* Trigger BufUnload for buffers that are loaded */
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ FOR_ALL_BUFFERS(buf)
if (buf->b_ml.ml_mfp != NULL)
{
bufref_T bufref;