aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/memline.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-08-19 23:49:25 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-08-19 23:49:25 -0400
commite1c330a486c184152cb48d637c6d04caba5290bd (patch)
treeb2379cae30ea446456681d1dc62d80ef95345f69 /src/nvim/memline.c
parent0b7bff5bb71ddc2e9c41863ec41b9aea74d0fe75 (diff)
parent888a31ba454cf9c054527a26459c112593efa54b (diff)
downloadrneovim-e1c330a486c184152cb48d637c6d04caba5290bd.tar.gz
rneovim-e1c330a486c184152cb48d637c6d04caba5290bd.tar.bz2
rneovim-e1c330a486c184152cb48d637c6d04caba5290bd.zip
Merge pull request #1024 from war1025/dev/for_all_buffers
Add FOR_ALL_BUFFERS helper
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 */