aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/memline.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/memline.c')
-rw-r--r--src/nvim/memline.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index a10fc2b8c5..229de4ae1c 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -466,11 +466,11 @@ void ml_setname(buf_T *buf)
*/
void ml_open_files(void)
{
- buf_T *buf;
-
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
- if (!buf->b_p_ro || buf->b_changed)
+ FOR_ALL_BUFFERS(buf) {
+ if (!buf->b_p_ro || buf->b_changed) {
ml_open_file(buf);
+ }
+ }
}
/*
@@ -584,11 +584,10 @@ void ml_close(buf_T *buf, int del_file)
*/
void ml_close_all(int del_file)
{
- buf_T *buf;
-
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ FOR_ALL_BUFFERS(buf) {
ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0
|| vim_strchr(p_cpo, CPO_PRESERVE) == NULL));
+ }
spell_delete_wordlist(); /* delete the internal wordlist */
vim_deltempdir(); /* delete created temp directory */
}
@@ -599,11 +598,11 @@ void ml_close_all(int del_file)
*/
void ml_close_notmod(void)
{
- buf_T *buf;
-
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
- if (!bufIsChanged(buf))
+ FOR_ALL_BUFFERS(buf) {
+ if (!bufIsChanged(buf)) {
ml_close(buf, TRUE); /* close all not-modified buffers */
+ }
+ }
}
/*
@@ -1617,9 +1616,7 @@ static int recov_file_names(char_u **names, char_u *path, int prepend_dot)
*/
void ml_sync_all(int check_file, int check_char)
{
- buf_T *buf;
-
- for (buf = firstbuf; buf != NULL; buf = buf->b_next) {
+ FOR_ALL_BUFFERS(buf) {
if (buf->b_ml.ml_mfp == NULL || buf->b_ml.ml_mfp->mf_fname == NULL)
continue; /* no file */