1
0
forked from aniani/vim

patch 7.4.2101

Problem:    Looping over windows, buffers and tab pages is inconsistant.
Solution:   Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan)
This commit is contained in:
Bram Moolenaar
2016-07-24 22:04:11 +02:00
parent 6835dc61ae
commit 2932359000
33 changed files with 148 additions and 142 deletions

View File

@@ -1439,7 +1439,7 @@ find_buffer(typval_T *avar)
{
/* No full path name match, try a match with a URL or a "nofile"
* buffer, these don't use the full path. */
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
FOR_ALL_BUFFERS(buf)
if (buf->b_fname != NULL
&& (path_with_url(buf->b_fname)
#ifdef FEAT_QUICKFIX
@@ -1597,7 +1597,7 @@ buf_win_common(typval_T *argvars, typval_T *rettv, int get_nr)
++emsg_off;
buf = get_buf_tv(&argvars[0], TRUE);
#ifdef FEAT_WINDOWS
for (wp = firstwin; wp; wp = wp->w_next)
FOR_ALL_WINDOWS(wp)
{
++winnr;
if (wp->w_buffer == buf)
@@ -6383,7 +6383,7 @@ f_last_buffer_nr(typval_T *argvars UNUSED, typval_T *rettv)
int n = 0;
buf_T *buf;
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
FOR_ALL_BUFFERS(buf)
if (n < buf->b_fnum)
n = buf->b_fnum;
@@ -12373,7 +12373,7 @@ f_winrestcmd(typval_T *argvars UNUSED, typval_T *rettv)
char_u buf[50];
ga_init2(&ga, (int)sizeof(char), 70);
for (wp = firstwin; wp != NULL; wp = wp->w_next)
FOR_ALL_WINDOWS(wp)
{
sprintf((char *)buf, "%dresize %d|", winnr, wp->w_height);
ga_concat(&ga, buf);