patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated

Problem:    Code for making 'shortmess' temporarily empty is repeated.
Solution:   Add functions for making 'shortmess' empty and restoring it.
            (Christian Brabandt, closes #11709)
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 9c00b80..3bdbede 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -460,7 +460,6 @@
 #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 @@
 		buf = NULL;
 	    else
 	    {
+		save_clear_shm_value();
 		ex_cc(eap);
+		restore_shm_value();
 
 		buf = curbuf;
 		i = eap->line1 - 1;
@@ -568,13 +569,9 @@
 		{
 		    // 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 @@
 
 		// 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 @@
 
 		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)