patch 8.2.0500: using the same loop in many places
Problem: Using the same loop in many places.
Solution: Define more FOR_ALL macros. (Yegappan Lakshmanan, closes #5339)
diff --git a/src/globals.h b/src/globals.h
index 290f07d..ac48a79 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -676,6 +676,11 @@
for ((wp) = ((tp) == curtab) \
? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
+#define FOR_ALL_POPUPWINS(wp) \
+ for ((wp) = first_popupwin; (wp) != NULL; (wp) = (wp)->w_next)
+#define FOR_ALL_POPUPWINS_IN_TAB(tp, wp) \
+ for ((wp) = (tp)->tp_first_popupwin; (wp) != NULL; (wp) = (wp)->w_next)
+
EXTERN win_T *curwin; // currently active window
@@ -716,6 +721,9 @@
#define FOR_ALL_BUFFERS(buf) for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+#define FOR_ALL_BUF_WININFO(buf, wip) \
+ for ((wip) = (buf)->b_wininfo; (wip) != NULL; (wip) = (wip)->wi_next)
+
// Iterate through all the signs placed in a buffer
#define FOR_ALL_SIGNS_IN_BUF(buf, sign) \
for (sign = buf->b_signlist; sign != NULL; sign = sign->se_next)
@@ -1469,6 +1477,9 @@
// Line in which spell checking wasn't highlighted because it touched the
// cursor position in Insert mode.
EXTERN linenr_T spell_redraw_lnum INIT(= 0);
+
+#define FOR_ALL_SPELL_LANGS(slang) \
+ for ((slang) = first_lang; (slang) != NULL; (slang) = slang->sl_next)
#endif
#ifdef FEAT_CONCEAL
@@ -1822,3 +1833,6 @@
# define REPEATED_MSG_LOOKING 1
# define REPEATED_MSG_SAFESTATE 2
#endif
+
+#define FOR_ALL_LIST_ITEMS(l, li) \
+ for ((li) = (l)->lv_first; (li) != NULL; (li) = (li)->li_next)