comparison src/fileio.c @ 9649:fd9727ae3c49 v7.4.2101

commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 24 22:04:11 2016 +0200 patch 7.4.2101 Problem: Looping over windows, buffers and tab pages is inconsistant. Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Jul 2016 22:15:07 +0200
parents 42a8a81decdf
children 01c9630e80e0
comparison
equal deleted inserted replaced
9648:227649fd4301 9649:fd9727ae3c49
6086 char_u dirname[MAXPATHL]; 6086 char_u dirname[MAXPATHL];
6087 buf_T *buf; 6087 buf_T *buf;
6088 char_u *p; 6088 char_u *p;
6089 6089
6090 mch_dirname(dirname, MAXPATHL); 6090 mch_dirname(dirname, MAXPATHL);
6091 for (buf = firstbuf; buf != NULL; buf = buf->b_next) 6091 FOR_ALL_BUFFERS(buf)
6092 { 6092 {
6093 if (buf->b_fname != NULL 6093 if (buf->b_fname != NULL
6094 #ifdef FEAT_QUICKFIX 6094 #ifdef FEAT_QUICKFIX
6095 && !bt_nofile(buf) 6095 && !bt_nofile(buf)
6096 #endif 6096 #endif
6678 else 6678 else
6679 { 6679 {
6680 ++no_wait_return; 6680 ++no_wait_return;
6681 did_check_timestamps = TRUE; 6681 did_check_timestamps = TRUE;
6682 already_warned = FALSE; 6682 already_warned = FALSE;
6683 for (buf = firstbuf; buf != NULL; ) 6683 FOR_ALL_BUFFERS(buf)
6684 { 6684 {
6685 /* Only check buffers in a window. */ 6685 /* Only check buffers in a window. */
6686 if (buf->b_nwindows > 0) 6686 if (buf->b_nwindows > 0)
6687 { 6687 {
6688 bufref_T bufref; 6688 bufref_T bufref;
6697 * first one again. */ 6697 * first one again. */
6698 buf = firstbuf; 6698 buf = firstbuf;
6699 continue; 6699 continue;
6700 } 6700 }
6701 } 6701 }
6702 buf = buf->b_next;
6703 } 6702 }
6704 --no_wait_return; 6703 --no_wait_return;
6705 need_check_timestamps = FALSE; 6704 need_check_timestamps = FALSE;
6706 if (need_wait_return && didit == 2) 6705 if (need_wait_return && didit == 2)
6707 { 6706 {
8757 * equal to curbuf, but for some buffers there may not be a window. 8756 * equal to curbuf, but for some buffers there may not be a window.
8758 * So we change the buffer for the current window for a moment. This 8757 * So we change the buffer for the current window for a moment. This
8759 * gives problems when the autocommands make changes to the list of 8758 * gives problems when the autocommands make changes to the list of
8760 * buffers or windows... 8759 * buffers or windows...
8761 */ 8760 */
8762 for (buf = firstbuf; buf != NULL; buf = buf->b_next) 8761 FOR_ALL_BUFFERS(buf)
8763 { 8762 {
8764 if (buf->b_ml.ml_mfp != NULL) 8763 if (buf->b_ml.ml_mfp != NULL)
8765 { 8764 {
8766 /* find a window for this buffer and save some values */ 8765 /* find a window for this buffer and save some values */
8767 aucmd_prepbuf(&aco, buf); 8766 aucmd_prepbuf(&aco, buf);
8829 /* Find a window that is for the new buffer */ 8828 /* Find a window that is for the new buffer */
8830 if (buf == curbuf) /* be quick when buf is curbuf */ 8829 if (buf == curbuf) /* be quick when buf is curbuf */
8831 win = curwin; 8830 win = curwin;
8832 else 8831 else
8833 #ifdef FEAT_WINDOWS 8832 #ifdef FEAT_WINDOWS
8834 for (win = firstwin; win != NULL; win = win->w_next) 8833 FOR_ALL_WINDOWS(win)
8835 if (win->w_buffer == buf) 8834 if (win->w_buffer == buf)
8836 break; 8835 break;
8837 #else 8836 #else
8838 win = NULL; 8837 win = NULL;
8839 #endif 8838 #endif