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/misc1.c b/src/misc1.c
index ccd9b07..0a6dc87 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -2658,7 +2658,7 @@
/* If "count" is negative the caller must be doing something wrong. */
if (count < 1)
{
- IEMSGN("E950: Invalid count for del_bytes(): %ld", count);
+ siemsg("E950: Invalid count for del_bytes(): %ld", count);
return FAIL;
}
@@ -3521,7 +3521,7 @@
while (r != 'y' && r != 'n')
{
/* same highlighting as for wait_return */
- smsg_attr(HL_ATTR(HLF_R), (char_u *)"%s (y/n)?", str);
+ smsg_attr(HL_ATTR(HLF_R), "%s (y/n)?", str);
if (direct)
r = get_keystroke();
else
@@ -4060,7 +4060,7 @@
if (!mch_chdir((char *)var) && mch_dirname(IObuff, IOSIZE) == OK)
var = IObuff;
if (mch_chdir((char *)NameBuff) != 0)
- EMSG(_(e_prev_dir));
+ emsg(_(e_prev_dir));
}
#endif
homedir = vim_strsave(var);
@@ -9942,7 +9942,7 @@
int ret = FAIL;
char_u *eval_pat = NULL;
char_u *exp_pat = *pat;
- char_u *ignored_msg;
+ char *ignored_msg;
int usedlen;
if (*exp_pat == '%' || *exp_pat == '#' || *exp_pat == '<')
@@ -11434,7 +11434,7 @@
/* get a name for the temp file */
if ((tempname = vim_tempname('o', FALSE)) == NULL)
{
- EMSG(_(e_notmp));
+ emsg(_(e_notmp));
return NULL;
}
@@ -11465,7 +11465,7 @@
if (fd == NULL)
{
- EMSG2(_(e_notopen), tempname);
+ semsg(_(e_notopen), tempname);
goto done;
}
@@ -11485,7 +11485,7 @@
#endif
if (i != len)
{
- EMSG2(_(e_notread), tempname);
+ semsg(_(e_notread), tempname);
VIM_CLEAR(buffer);
}
else if (ret_len == NULL)