comparison 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
comparison
equal deleted inserted replaced
19887:d03edd8c7e2f 19888:435726a03481
674 #define FOR_ALL_TAB_WINDOWS(tp, wp) \ 674 #define FOR_ALL_TAB_WINDOWS(tp, wp) \
675 for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next) \ 675 for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next) \
676 for ((wp) = ((tp) == curtab) \ 676 for ((wp) = ((tp) == curtab) \
677 ? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next) 677 ? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
678 678
679 #define FOR_ALL_POPUPWINS(wp) \
680 for ((wp) = first_popupwin; (wp) != NULL; (wp) = (wp)->w_next)
681 #define FOR_ALL_POPUPWINS_IN_TAB(tp, wp) \
682 for ((wp) = (tp)->tp_first_popupwin; (wp) != NULL; (wp) = (wp)->w_next)
683
679 684
680 EXTERN win_T *curwin; // currently active window 685 EXTERN win_T *curwin; // currently active window
681 686
682 EXTERN win_T *aucmd_win; // window used in aucmd_prepbuf() 687 EXTERN win_T *aucmd_win; // window used in aucmd_prepbuf()
683 EXTERN int aucmd_win_used INIT(= FALSE); // aucmd_win is being used 688 EXTERN int aucmd_win_used INIT(= FALSE); // aucmd_win is being used
713 EXTERN buf_T *firstbuf INIT(= NULL); // first buffer 718 EXTERN buf_T *firstbuf INIT(= NULL); // first buffer
714 EXTERN buf_T *lastbuf INIT(= NULL); // last buffer 719 EXTERN buf_T *lastbuf INIT(= NULL); // last buffer
715 EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer 720 EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer
716 721
717 #define FOR_ALL_BUFFERS(buf) for (buf = firstbuf; buf != NULL; buf = buf->b_next) 722 #define FOR_ALL_BUFFERS(buf) for (buf = firstbuf; buf != NULL; buf = buf->b_next)
723
724 #define FOR_ALL_BUF_WININFO(buf, wip) \
725 for ((wip) = (buf)->b_wininfo; (wip) != NULL; (wip) = (wip)->wi_next)
718 726
719 // Iterate through all the signs placed in a buffer 727 // Iterate through all the signs placed in a buffer
720 #define FOR_ALL_SIGNS_IN_BUF(buf, sign) \ 728 #define FOR_ALL_SIGNS_IN_BUF(buf, sign) \
721 for (sign = buf->b_signlist; sign != NULL; sign = sign->se_next) 729 for (sign = buf->b_signlist; sign != NULL; sign = sign->se_next)
722 730
1467 1475
1468 #ifdef FEAT_SPELL 1476 #ifdef FEAT_SPELL
1469 // Line in which spell checking wasn't highlighted because it touched the 1477 // Line in which spell checking wasn't highlighted because it touched the
1470 // cursor position in Insert mode. 1478 // cursor position in Insert mode.
1471 EXTERN linenr_T spell_redraw_lnum INIT(= 0); 1479 EXTERN linenr_T spell_redraw_lnum INIT(= 0);
1480
1481 #define FOR_ALL_SPELL_LANGS(slang) \
1482 for ((slang) = first_lang; (slang) != NULL; (slang) = slang->sl_next)
1472 #endif 1483 #endif
1473 1484
1474 #ifdef FEAT_CONCEAL 1485 #ifdef FEAT_CONCEAL
1475 // Set when the cursor line needs to be redrawn. 1486 // Set when the cursor line needs to be redrawn.
1476 EXTERN int need_cursor_line_redraw INIT(= FALSE); 1487 EXTERN int need_cursor_line_redraw INIT(= FALSE);
1820 #if defined(FEAT_JOB_CHANNEL) 1831 #if defined(FEAT_JOB_CHANNEL)
1821 EXTERN int did_repeated_msg INIT(= 0); 1832 EXTERN int did_repeated_msg INIT(= 0);
1822 # define REPEATED_MSG_LOOKING 1 1833 # define REPEATED_MSG_LOOKING 1
1823 # define REPEATED_MSG_SAFESTATE 2 1834 # define REPEATED_MSG_SAFESTATE 2
1824 #endif 1835 #endif
1836
1837 #define FOR_ALL_LIST_ITEMS(l, li) \
1838 for ((li) = (l)->lv_first; (li) != NULL; (li) = (li)->li_next)