summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 9c00b80b7a..3bdbede138 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -460,7 +460,6 @@ ex_listdo(exarg_T *eap)
#if defined(FEAT_SYN_HL)
char_u *save_ei = NULL;
#endif
- char_u *p_shm_save;
#ifdef FEAT_QUICKFIX
int qf_size = 0;
int qf_idx;
@@ -541,7 +540,9 @@ ex_listdo(exarg_T *eap)
buf = NULL;
else
{
+ save_clear_shm_value();
ex_cc(eap);
+ restore_shm_value();
buf = curbuf;
i = eap->line1 - 1;
@@ -568,13 +569,9 @@ ex_listdo(exarg_T *eap)
{
// Clear 'shm' to avoid that the file message overwrites
// any output from the command.
- p_shm_save = vim_strsave(p_shm);
- set_option_value_give_err((char_u *)"shm",
- 0L, (char_u *)"", 0);
+ save_clear_shm_value();
do_argfile(eap, i);
- set_option_value_give_err((char_u *)"shm",
- 0L, p_shm_save, 0);
- vim_free(p_shm_save);
+ restore_shm_value();
}
if (curwin->w_arg_idx != i)
break;
@@ -630,11 +627,9 @@ ex_listdo(exarg_T *eap)
// Go to the next buffer. Clear 'shm' to avoid that the file
// message overwrites any output from the command.
- p_shm_save = vim_strsave(p_shm);
- set_option_value_give_err((char_u *)"shm", 0L, (char_u *)"", 0);
+ save_clear_shm_value();
goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum);
- set_option_value_give_err((char_u *)"shm", 0L, p_shm_save, 0);
- vim_free(p_shm_save);
+ restore_shm_value();
// If autocommands took us elsewhere, quit here.
if (curbuf->b_fnum != next_fnum)
@@ -650,13 +645,9 @@ ex_listdo(exarg_T *eap)
qf_idx = qf_get_cur_idx(eap);
- // Clear 'shm' to avoid that the file message overwrites
- // any output from the command.
- p_shm_save = vim_strsave(p_shm);
- set_option_value_give_err((char_u *)"shm", 0L, (char_u *)"", 0);
+ save_clear_shm_value();
ex_cnext(eap);
- set_option_value_give_err((char_u *)"shm", 0L, p_shm_save, 0);
- vim_free(p_shm_save);
+ restore_shm_value();
// If jumping to the next quickfix entry fails, quit here
if (qf_get_cur_idx(eap) == qf_idx)