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/diff.c b/src/diff.c
index 287f434..35e37d7 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -65,7 +65,7 @@
int i;
tabpage_T *tp;
- for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+ FOR_ALL_TABPAGES(tp)
{
i = diff_buf_idx_tp(buf, tp);
if (i != DB_COUNT)
@@ -92,7 +92,7 @@
{
/* When there is no window showing a diff for this buffer, remove
* it from the diffs. */
- for (wp = firstwin; wp != NULL; wp = wp->w_next)
+ FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == win->w_buffer && wp->w_p_diff)
break;
if (wp == NULL)
@@ -178,7 +178,7 @@
tabpage_T *tp;
int i;
- for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+ FOR_ALL_TABPAGES(tp)
{
i = diff_buf_idx_tp(buf, tp);
if (i != DB_COUNT)
@@ -204,7 +204,7 @@
tabpage_T *tp;
/* Handle all tab pages that use the current buffer in a diff. */
- for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+ FOR_ALL_TABPAGES(tp)
{
idx = diff_buf_idx_tp(curbuf, tp);
if (idx != DB_COUNT)
@@ -591,7 +591,7 @@
win_T *wp;
int n;
- for (wp = firstwin; wp != NULL; wp = wp->w_next)
+ FOR_ALL_WINDOWS(wp)
if (wp->w_p_diff)
{
redraw_win_later(wp, SOME_VALID);
@@ -1198,7 +1198,7 @@
int diffwin = FALSE;
#endif
- for (wp = firstwin; wp != NULL; wp = wp->w_next)
+ FOR_ALL_WINDOWS(wp)
{
if (eap->forceit ? wp->w_p_diff : wp == curwin)
{
@@ -1879,7 +1879,7 @@
/* If "icase" or "iwhite" was added or removed, need to update the diff. */
if (diff_flags != diff_flags_new)
- for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+ FOR_ALL_TABPAGES(tp)
tp->tp_diff_invalid = TRUE;
diff_flags = diff_flags_new;
@@ -2434,7 +2434,7 @@
int i;
win_T *wp;
- for (wp = firstwin; wp != NULL; wp = wp->w_next)
+ FOR_ALL_WINDOWS(wp)
for (i = 0; i < DB_COUNT; ++i)
if (curtab->tp_diffbuf[i] == wp->w_buffer && i != skip_idx)
foldUpdate(wp, dp->df_lnum[i],
@@ -2450,7 +2450,7 @@
{
tabpage_T *tp;
- for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+ FOR_ALL_TABPAGES(tp)
if (diff_buf_idx_tp(buf, tp) != DB_COUNT)
return TRUE;
return FALSE;