diff src/globals.h @ 19888:435726a03481 v8.2.0500

patch 8.2.0500: using the same loop in many places Commit: https://github.com/vim/vim/commit/aeea72151c31d686bcbb7b06d895006d7363585c Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 2 18:50:46 2020 +0200 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 https://github.com/vim/vim/issues/5339)
author Bram Moolenaar <Bram@vim.org>
date Thu, 02 Apr 2020 19:00:05 +0200
parents 293a22b677a8
children bd4f91762d0f
line wrap: on
line diff
--- a/src/globals.h
+++ b/src/globals.h
@@ -676,6 +676,11 @@ EXTERN win_T	*prevwin INIT(= NULL);	// p
 	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 @@ EXTERN buf_T	*curbuf INIT(= NULL);	// cu
 
 #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 @@ EXTERN disptick_T	display_tick INIT(= 0)
 // 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 @@ EXTERN int did_repeated_msg INIT(= 0);
 # 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)