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.
diff --git a/src/gui.c b/src/gui.c
index 8c35119..ed89985 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -215,7 +215,7 @@
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 @@
# 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 @@
if (result != MAYBE)
{
if (result == FAIL)
- EMSG(_("E229: Cannot start the GUI"));
+ emsg(_("E229: Cannot start the GUI"));
return result;
}
@@ -515,7 +515,7 @@
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_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 @@
#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.in_use
#endif
)
- EMSG2(_("E254: Cannot allocate color %s"), name);
+ semsg(_("E254: Cannot allocate color %s"), name);
return t;
}