diff src/mbyte.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 27b9a84395b5
children 79e3dcc5aa50
line wrap: on
line diff
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -199,7 +199,7 @@ xim_log(char *s, ...)
 	fd = mch_fopen("xim.log", "w");
 	if (fd == NULL)
 	{
-	    EMSG("Cannot open xim.log");
+	    emsg("Cannot open xim.log");
 	    fd = (FILE *)-1;
 	    return;
 	}
@@ -509,7 +509,7 @@ enc_canon_props(char_u *name)
  * When there is something wrong: Returns an error message and doesn't change
  * anything.
  */
-    char_u *
+    char *
 mb_init(void)
 {
     int		i;
@@ -4749,7 +4749,7 @@ iconv_enabled(int verbose)
 	if (verbose && p_verbose > 0)
 	{
 	    verbose_enter();
-	    EMSG2(_(e_loadlib),
+	    semsg(_(e_loadlib),
 		    hIconvDLL == 0 ? DYNAMIC_ICONV_DLL : DYNAMIC_MSVCRT_DLL);
 	    verbose_leave();
 	}
@@ -4771,7 +4771,7 @@ iconv_enabled(int verbose)
 	if (verbose && p_verbose > 0)
 	{
 	    verbose_enter();
-	    EMSG2(_(e_loadfunc), "for libiconv");
+	    semsg(_(e_loadfunc), "for libiconv");
 	    verbose_leave();
 	}
 	return FALSE;
@@ -6028,7 +6028,7 @@ xim_set_preedit(void)
 					XNLineSpace, line_space,
 					NULL);
 	if (XSetICValues(xic, XNPreeditAttributes, attr_list, NULL))
-	    EMSG(_("E284: Cannot set IC values"));
+	    emsg(_("E284: Cannot set IC values"));
 	XFree(attr_list);
     }
 }
@@ -6187,7 +6187,7 @@ xim_real_init(Window x11_window, Display
 	if (p_verbose > 0)
 	{
 	    verbose_enter();
-	    EMSG(_("E286: Failed to open input method"));
+	    emsg(_("E286: Failed to open input method"));
 	    verbose_leave();
 	}
 	return FALSE;
@@ -6200,13 +6200,13 @@ xim_real_init(Window x11_window, Display
 	destroy_cb.callback = xim_destroy_cb;
 	destroy_cb.client_data = NULL;
 	if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL))
-	    EMSG(_("E287: Warning: Could not set destroy callback to IM"));
+	    emsg(_("E287: Warning: Could not set destroy callback to IM"));
     }
 #  endif
 
     if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles)
     {
-	EMSG(_("E288: input method doesn't support any style"));
+	emsg(_("E288: input method doesn't support any style"));
 	XCloseIM(xim);
 	return FALSE;
     }
@@ -6265,7 +6265,7 @@ xim_real_init(Window x11_window, Display
 	if (p_verbose > 0)
 	{
 	    verbose_enter();
-	    EMSG(_("E289: input method doesn't support my preedit type"));
+	    emsg(_("E289: input method doesn't support my preedit type"));
 	    verbose_leave();
 	}
 	XCloseIM(xim);
@@ -6329,7 +6329,7 @@ xim_real_init(Window x11_window, Display
     else
     {
 	if (!is_not_a_term())
-	    EMSG(_(e_xim));
+	    emsg(_(e_xim));
 	XCloseIM(xim);
 	return FALSE;
     }