aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/memfile.c
diff options
context:
space:
mode:
authorWayne Rowcliffe <war1025@gmail.com>2014-08-02 20:19:33 -0500
committerWayne Rowcliffe <war1025@gmail.com>2014-08-02 20:19:33 -0500
commit8cf45786b11c4c96444962227a960a3683d9f2b1 (patch)
treecb77b3c5ffb31809b004f08ef4288575ecfc1c40 /src/nvim/memfile.c
parent44afe610f8cfbb72141fddd4b13f5fe54386211f (diff)
downloadrneovim-8cf45786b11c4c96444962227a960a3683d9f2b1.tar.gz
rneovim-8cf45786b11c4c96444962227a960a3683d9f2b1.tar.bz2
rneovim-8cf45786b11c4c96444962227a960a3683d9f2b1.zip
Add FOR_ALL_BUFFERS helper
Diffstat (limited to 'src/nvim/memfile.c')
-rw-r--r--src/nvim/memfile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c
index 6e8d8f9972..8acf25f484 100644
--- a/src/nvim/memfile.c
+++ b/src/nvim/memfile.c
@@ -632,9 +632,11 @@ static bhdr_T *mf_release(memfile_T *mfp, int page_count)
*/
if (mfp->mf_fd < 0 && need_release && p_uc) {
/* find for which buffer this memfile is */
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
- if (buf->b_ml.ml_mfp == mfp)
+ FOR_ALL_BUFFERS(buf) {
+ if (buf->b_ml.ml_mfp == mfp) {
break;
+ }
+ }
if (buf != NULL && buf->b_may_swap)
ml_open_file(buf);
}
@@ -691,7 +693,7 @@ int mf_release_all(void)
bhdr_T *hp;
int retval = FALSE;
- for (buf = firstbuf; buf != NULL; buf = buf->b_next) {
+ FOR_ALL_BUFFERS(buf) {
mfp = buf->b_ml.ml_mfp;
if (mfp != NULL) {
/* If no swap file yet, may open one */