aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.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/ex_cmds.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/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 48e75190aa..5b6604fc93 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -1211,7 +1211,6 @@ do_shell (
int flags /* may be SHELL_DOOUT when output is redirected */
)
{
- buf_T *buf;
int save_nwr;
/*
@@ -1239,11 +1238,12 @@ do_shell (
if (p_warn
&& !autocmd_busy
&& msg_silent == 0)
- for (buf = firstbuf; buf; buf = buf->b_next)
+ FOR_ALL_BUFFERS(buf) {
if (bufIsChanged(buf)) {
MSG_PUTS(_("[No write since last change]\n"));
break;
}
+ }
/* This windgoto is required for when the '\n' resulted in a "delete line
* 1" command to the terminal. */
@@ -1753,7 +1753,6 @@ static void do_viminfo(FILE *fp_in, FILE *fp_out, int flags)
static int read_viminfo_up_to_marks(vir_T *virp, int forceit, int writing)
{
int eof;
- buf_T *buf;
prepare_viminfo_history(forceit ? 9999 : 0, writing);
eof = viminfo_readline(virp);
@@ -1816,8 +1815,9 @@ static int read_viminfo_up_to_marks(vir_T *virp, int forceit, int writing)
finish_viminfo_history();
/* Change file names to buffer numbers for fmarks. */
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ FOR_ALL_BUFFERS(buf) {
fmarks_check_names(buf);
+ }
return eof;
}
@@ -2362,14 +2362,13 @@ void ex_wnext(exarg_T *eap)
*/
void do_wqall(exarg_T *eap)
{
- buf_T *buf;
int error = 0;
int save_forceit = eap->forceit;
if (eap->cmdidx == CMD_xall || eap->cmdidx == CMD_wqall)
exiting = TRUE;
- for (buf = firstbuf; buf != NULL; buf = buf->b_next) {
+ FOR_ALL_BUFFERS(buf) {
if (bufIsChanged(buf)) {
/*
* Check if there is a reason the buffer cannot be written:
@@ -5679,7 +5678,6 @@ void ex_sign(exarg_T *eap)
int idx;
sign_T *sp;
sign_T *sp_prev;
- buf_T *buf;
/* Parse the subcommand. */
p = skiptowhite(arg);
@@ -5906,10 +5904,11 @@ void ex_sign(exarg_T *eap)
if (idx == SIGNCMD_UNPLACE && *arg == NUL)
{
/* ":sign unplace {id}": remove placed sign by number */
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
- if ((lnum = buf_delsign(buf, id)) != 0)
- update_debug_sign(buf, lnum);
- return;
+ FOR_ALL_BUFFERS(buf) {
+ if ((lnum = buf_delsign(buf, id)) != 0)
+ update_debug_sign(buf, lnum);
+ return;
+ }
}
}
}
@@ -5918,6 +5917,8 @@ void ex_sign(exarg_T *eap)
* Check for line={lnum} name={name} and file={fname} or buffer={nr}.
* Leave "arg" pointing to {fname}.
*/
+
+ buf_T *buf = NULL;
for (;;)
{
if (STRNCMP(arg, "line=", 5) == 0)