Mercurial > vim
diff src/term.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 | 6fcfff2b4ba5 |
children | dd725a8ab112 |
line wrap: on
line diff
--- a/src/term.c +++ b/src/term.c @@ -92,7 +92,7 @@ static int term_is_builtin(char_u *name) static int term_7to8bit(char_u *p); #ifdef HAVE_TGETENT -static char_u *tgetent_error(char_u *, char_u *); +static char *tgetent_error(char_u *, char_u *); /* * Here is our own prototype for tgetstr(), any prototypes from the include @@ -1357,7 +1357,7 @@ termgui_get_color(char_u *name) t = termgui_mch_get_color(name); if (t == INVALCOLOR) - EMSG2(_("E254: Cannot allocate color %s"), name); + semsg(_("E254: Cannot allocate color %s"), name); return t; } @@ -1696,14 +1696,14 @@ get_term_entries(int *height, int *width #endif static void -report_term_error(char_u *error_msg, char_u *term) +report_term_error(char *error_msg, char_u *term) { struct builtin_term *termp; mch_errmsg("\r\n"); if (error_msg != NULL) { - mch_errmsg((char *)error_msg); + mch_errmsg(error_msg); mch_errmsg("\r\n"); } mch_errmsg("'"); @@ -1756,7 +1756,7 @@ set_termname(char_u *term) int termcap_cleared = FALSE; #endif int width = 0, height = 0; - char_u *error_msg = NULL; + char *error_msg = NULL; char_u *bs_p, *del_p; /* In silect mode (ex -s) we don't use the 'term' option. */ @@ -2191,7 +2191,7 @@ del_mouse_termcode( * Call tgetent() * Return error message if it fails, NULL if it's OK. */ - static char_u * + static char * tgetent_error(char_u *tbuf, char_u *term) { int i; @@ -2210,13 +2210,13 @@ tgetent_error(char_u *tbuf, char_u *term if (i < 0) # ifdef TGETENT_ZERO_ERR - return (char_u *)_("E557: Cannot open termcap file"); + return _("E557: Cannot open termcap file"); if (i == 0) # endif #ifdef TERMINFO - return (char_u *)_("E558: Terminal entry not found in terminfo"); + return _("E558: Terminal entry not found in terminfo"); #else - return (char_u *)_("E559: Terminal entry not found in termcap"); + return _("E559: Terminal entry not found in termcap"); #endif } return NULL; @@ -2282,7 +2282,7 @@ add_termcap_entry(char_u *name, int forc char_u tbuf[TBUFSZ]; char_u tstrbuf[TBUFSZ]; char_u *tp = tstrbuf; - char_u *error_msg = NULL; + char *error_msg = NULL; #endif /* @@ -2369,10 +2369,10 @@ add_termcap_entry(char_u *name, int forc { #ifdef HAVE_TGETENT if (error_msg != NULL) - EMSG(error_msg); + emsg(error_msg); else #endif - EMSG2(_("E436: No \"%s\" entry in termcap"), name); + semsg(_("E436: No \"%s\" entry in termcap"), name); } return FAIL; } @@ -3055,7 +3055,7 @@ ttest(int pairs) * MUST have "cm": cursor motion. */ if (*T_CM == NUL) - EMSG(_("E437: terminal capability \"cm\" required")); + emsg(_("E437: terminal capability \"cm\" required")); /* * if "cs" defined, use a scroll region, it's faster. @@ -6153,7 +6153,7 @@ replace_termcodes( if (STRNICMP(src, "<SID>", 5) == 0) { if (current_sctx.sc_sid <= 0) - EMSG(_(e_usingsid)); + emsg(_(e_usingsid)); else { src += 5;