aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-09-08 20:50:44 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-09-08 20:50:44 -0400
commit9fa467a9b227243c9c534ae0df1bdaf8235551a0 (patch)
tree85449173705a443081b1189a9d1087df74030703 /src/nvim/fileio.c
parent3f5482d3251b3bbdc7c4df8a8e64eb3af7e5922c (diff)
parentac0b9714edbb7697b8324f922024401baea8953b (diff)
downloadrneovim-9fa467a9b227243c9c534ae0df1bdaf8235551a0.tar.gz
rneovim-9fa467a9b227243c9c534ae0df1bdaf8235551a0.tar.bz2
rneovim-9fa467a9b227243c9c534ae0df1bdaf8235551a0.zip
Merge pull request #1096 from war1025/dev/local_for_all_windows
Convert FOR_ALL_WINDOWS to use a locally declared pointer
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 0a05b2a4db..97daa035f8 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -6177,12 +6177,17 @@ aucmd_prepbuf (
int save_acd;
/* Find a window that is for the new buffer */
- if (buf == curbuf) /* be quick when buf is curbuf */
+ if (buf == curbuf) { /* be quick when buf is curbuf */
win = curwin;
- else
- for (win = firstwin; win != NULL; win = win->w_next)
- if (win->w_buffer == buf)
+ } else {
+ win = NULL;
+ FOR_ALL_WINDOWS(wp) {
+ if (wp->w_buffer == buf) {
+ win = wp;
break;
+ }
+ }
+ }
/* Allocate "aucmd_win" when needed. If this fails (out of memory) fall
* back to using the current window. */