From 2932359000b2f918d5fade79ea4d124d5943cd07 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 24 Jul 2016 22:04:11 +0200 Subject: patch 7.4.2101 Problem: Looping over windows, buffers and tab pages is inconsistant. Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan) --- src/evalfunc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/evalfunc.c') diff --git a/src/evalfunc.c b/src/evalfunc.c index ec347c112..ae17038cc 100644 --- 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_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); -- cgit v1.2.1