summaryrefslogtreecommitdiffstats
path: root/src/globals.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-02 18:50:46 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-02 18:50:46 +0200
commitaeea72151c31d686bcbb7b06d895006d7363585c (patch)
tree500d487503a1a82cecc8f2a3e9bf89b50638fe5a /src/globals.h
parentf10806b25090879fdc1a86cc0da2f4f34fd21921 (diff)
patch 8.2.0500: using the same loop in many placesv8.2.0500
Problem: Using the same loop in many places. Solution: Define more FOR_ALL macros. (Yegappan Lakshmanan, closes #5339)
Diffstat (limited to 'src/globals.h')
-rw-r--r--src/globals.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/globals.h b/src/globals.h
index 290f07dd5e..ac48a793d1 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -676,6 +676,11 @@ EXTERN win_T *prevwin INIT(= NULL); // previous window
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); // currently active buffer
#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)