Mercurial > vim
diff src/evalfunc.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 | ccbb8e393d80 |
children | 6255ff1ea003 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -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 ++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 UNUSE 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, t 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);