aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.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/eval.c
parent44afe610f8cfbb72141fddd4b13f5fe54386211f (diff)
downloadrneovim-8cf45786b11c4c96444962227a960a3683d9f2b1.tar.gz
rneovim-8cf45786b11c4c96444962227a960a3683d9f2b1.tar.bz2
rneovim-8cf45786b11c4c96444962227a960a3683d9f2b1.zip
Add FOR_ALL_BUFFERS helper
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 9ccf00a3fe..382b43826d 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -5434,8 +5434,9 @@ int garbage_collect(void)
set_ref_in_ht(&SCRIPT_VARS(i), copyID);
/* buffer-local variables */
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ FOR_ALL_BUFFERS(buf) {
set_ref_in_item(&buf->b_bufvar.di_tv, copyID);
+ }
/* window-local variables */
FOR_ALL_TAB_WINDOWS(tp, wp)
@@ -7207,13 +7208,14 @@ static buf_T *find_buffer(typval_T *avar)
if (buf == NULL) {
/* No full path name match, try a match with a URL or a "nofile"
* buffer, these don't use the full path. */
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ FOR_ALL_BUFFERS(buf) {
if (buf->b_fname != NULL
&& (path_with_url(buf->b_fname)
|| bt_nofile(buf)
)
&& STRCMP(buf->b_fname, avar->vval.v_string) == 0)
break;
+ }
}
}
return buf;
@@ -10617,9 +10619,11 @@ static void f_last_buffer_nr(typval_T *argvars, typval_T *rettv)
int n = 0;
buf_T *buf;
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
- if (n < buf->b_fnum)
+ FOR_ALL_BUFFERS(buf) {
+ if (n < buf->b_fnum) {
n = buf->b_fnum;
+ }
+ }
rettv->vval.v_number = n;
}