diff src/gui.c @ 15470:55ccc2d353bd v8.1.0743

patch 8.1.0743: giving error messages is not flexible commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 13 23:38:42 2019 +0100 patch 8.1.0743: giving error messages is not flexible Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes #3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts.
author Bram Moolenaar <Bram@vim.org>
date Sun, 13 Jan 2019 23:45:08 +0100
parents 29f3d59bb6f0
children 41fbbcea0f1b
line wrap: on
line diff
--- a/src/gui.c
+++ b/src/gui.c
@@ -215,7 +215,7 @@ gui_do_fork(void)
     pid = fork();
     if (pid < 0)	    /* Fork error */
     {
-	EMSG(_("E851: Failed to create a new process for the GUI"));
+	emsg(_("E851: Failed to create a new process for the GUI"));
 	return;
     }
     else if (pid > 0)	    /* Parent */
@@ -239,7 +239,7 @@ gui_do_fork(void)
 # else
 		waitpid(pid, &exit_status, 0);
 # endif
-		EMSG(_("E852: The child process failed to start the GUI"));
+		emsg(_("E852: The child process failed to start the GUI"));
 		return;
 	    }
 	    else if (status == GUI_CHILD_IO_ERROR)
@@ -362,7 +362,7 @@ gui_init_check(void)
     if (result != MAYBE)
     {
 	if (result == FAIL)
-	    EMSG(_("E229: Cannot start the GUI"));
+	    emsg(_("E229: Cannot start the GUI"));
 	return result;
     }
 
@@ -515,7 +515,7 @@ gui_init(void)
 	    if (STRCMP(use_gvimrc, "NONE") != 0
 		    && STRCMP(use_gvimrc, "NORC") != 0
 		    && do_source(use_gvimrc, FALSE, DOSO_NONE) != OK)
-		EMSG2(_("E230: Cannot read from \"%s\""), use_gvimrc);
+		semsg(_("E230: Cannot read from \"%s\""), use_gvimrc);
 	}
 	else
 	{
@@ -649,12 +649,12 @@ gui_init(void)
 	    gui_init_font(*p_guifont == NUL ? hl_get_font_name()
 						  : p_guifont, FALSE) == FAIL)
     {
-	EMSG(_("E665: Cannot start GUI, no valid font found"));
+	emsg(_("E665: Cannot start GUI, no valid font found"));
 	goto error2;
     }
 #ifdef FEAT_MBYTE
     if (gui_get_wide_font() == FAIL)
-	EMSG(_("E231: 'guifontwide' invalid"));
+	emsg(_("E231: 'guifontwide' invalid"));
 #endif
 
     gui.num_cols = Columns;
@@ -769,7 +769,7 @@ gui_init(void)
 
 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
 	if (!im_xim_isvalid_imactivate())
-	    EMSG(_("E599: Value of 'imactivatekey' is invalid"));
+	    emsg(_("E599: Value of 'imactivatekey' is invalid"));
 #endif
 	/* When 'cmdheight' was set during startup it may not have taken
 	 * effect yet. */
@@ -4785,7 +4785,7 @@ gui_get_color(char_u *name)
 	    && gui.in_use
 #endif
 	    )
-	EMSG2(_("E254: Cannot allocate color %s"), name);
+	semsg(_("E254: Cannot allocate color %s"), name);
     return t;
 }