diff options
author | Wayne Rowcliffe <war1025@gmail.com> | 2014-08-20 18:35:07 -0500 |
---|---|---|
committer | Wayne Rowcliffe <war1025@gmail.com> | 2014-09-08 17:27:41 -0500 |
commit | fe99930c46c096b9be277d3201b3ea9b5bf2f659 (patch) | |
tree | 243fdae47827774138943822b4237c1decdd8a16 /src/nvim/ex_cmds2.c | |
parent | 3f5482d3251b3bbdc7c4df8a8e64eb3af7e5922c (diff) | |
download | rneovim-fe99930c46c096b9be277d3201b3ea9b5bf2f659.tar.gz rneovim-fe99930c46c096b9be277d3201b3ea9b5bf2f659.tar.bz2 rneovim-fe99930c46c096b9be277d3201b3ea9b5bf2f659.zip |
Convert FOR_ALL_WINDOWS to use a locally declared pointer
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r-- | src/nvim/ex_cmds2.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index ac91b2a6ac..fdf225c073 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1206,7 +1206,6 @@ check_changed_any ( int bufcount = 0; int *bufnrs; tabpage_T *tp; - win_T *wp; FOR_ALL_BUFFERS(buf) { ++bufcount; @@ -1220,15 +1219,21 @@ check_changed_any ( /* curbuf */ bufnrs[bufnum++] = curbuf->b_fnum; /* buf in curtab */ - FOR_ALL_WINDOWS(wp) - if (wp->w_buffer != curbuf) - add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); + FOR_ALL_WINDOWS(wp) { + if (wp->w_buffer != curbuf) { + add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); + } + } /* buf in other tab */ - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) - if (tp != curtab) - for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) + for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) { + if (tp != curtab) { + for (wint_T *wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) { add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); + } + } + } + /* any other buf */ FOR_ALL_BUFFERS(buf) { add_bufnum(bufnrs, &bufnum, buf->b_fnum); @@ -1278,14 +1283,16 @@ check_changed_any ( /* Try to find a window that contains the buffer. */ if (buf != curbuf) - FOR_ALL_TAB_WINDOWS(tp, wp) - if (wp->w_buffer == buf) { - goto_tabpage_win(tp, wp); - /* Paranoia: did autocms wipe out the buffer with changes? */ - if (!buf_valid(buf)) { - goto theend; + wint_T *wp; + FOR_ALL_TAB_WINDOWS(tp, wp) { + if (wp->w_buffer == buf) { + goto_tabpage_win(tp, wp); + /* Paranoia: did autocms wipe out the buffer with changes? */ + if (!buf_valid(buf)) { + goto theend; + } + goto buf_found; } - goto buf_found; } buf_found: |