aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 6b8c2f4d4d..1de4b04a07 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -744,7 +744,6 @@ main_loop (
/* Exit properly */
void getout(int exitval)
{
- buf_T *buf;
win_T *wp;
tabpage_T *tp, *next_tp;
@@ -772,7 +771,7 @@ void getout(int exitval)
if (wp->w_buffer == NULL)
/* Autocmd must have close the buffer already, skip. */
continue;
- buf = wp->w_buffer;
+ buf_T *buf = wp->w_buffer;
if (buf->b_changedtick != -1) {
apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname,
buf->b_fname, FALSE, buf);
@@ -785,13 +784,14 @@ void getout(int exitval)
}
/* Trigger BufUnload for buffers that are loaded */
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ FOR_ALL_BUFFERS(buf) {
if (buf->b_ml.ml_mfp != NULL) {
apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname,
FALSE, buf);
if (!buf_valid(buf)) /* autocmd may delete the buffer */
break;
}
+ }
apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
}