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/if_ruby.c b/src/if_ruby.c
index dc5511e..fb1b25b 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -745,7 +745,7 @@
if (!hinstRuby)
{
if (verbose)
- EMSG2(_(e_loadlib), libname);
+ semsg(_(e_loadlib), libname);
return FAIL;
}
@@ -757,7 +757,7 @@
close_dll(hinstRuby);
hinstRuby = NULL;
if (verbose)
- EMSG2(_(e_loadfunc), ruby_funcname_table[i].name);
+ semsg(_(e_loadfunc), ruby_funcname_table[i].name);
return FAIL;
}
}
@@ -885,7 +885,7 @@
{
if (TYPE(line) != T_STRING)
{
- EMSG(_("E265: $_ must be an instance of String"));
+ emsg(_("E265: $_ must be an instance of String"));
return;
}
ml_replace(i, (char_u *) StringValuePtr(line), 1);
@@ -979,7 +979,7 @@
}
else
{
- EMSG(_("E266: Sorry, this command is disabled, the Ruby library could not be loaded."));
+ emsg(_("E266: Sorry, this command is disabled, the Ruby library could not be loaded."));
return 0;
}
#endif
@@ -1013,19 +1013,19 @@
switch (state)
{
case TAG_RETURN:
- EMSG(_("E267: unexpected return"));
+ emsg(_("E267: unexpected return"));
break;
case TAG_NEXT:
- EMSG(_("E268: unexpected next"));
+ emsg(_("E268: unexpected next"));
break;
case TAG_BREAK:
- EMSG(_("E269: unexpected break"));
+ emsg(_("E269: unexpected break"));
break;
case TAG_REDO:
- EMSG(_("E270: unexpected redo"));
+ emsg(_("E270: unexpected redo"));
break;
case TAG_RETRY:
- EMSG(_("E271: retry outside of rescue clause"));
+ emsg(_("E271: retry outside of rescue clause"));
break;
case TAG_RAISE:
case TAG_FATAL:
@@ -1038,7 +1038,7 @@
einfo = rb_obj_as_string(error);
if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0)
{
- EMSG(_("E272: unhandled exception"));
+ emsg(_("E272: unhandled exception"));
}
else
{
@@ -1050,7 +1050,7 @@
RSTRING_PTR(epath), RSTRING_PTR(einfo));
p = strchr(buff, '\n');
if (p) *p = '\0';
- EMSG(buff);
+ emsg(buff);
}
attr = syn_name2attr((char_u *)"Error");
@@ -1066,7 +1066,7 @@
break;
default:
vim_snprintf(buff, BUFSIZ, _("E273: unknown longjmp status %d"), state);
- EMSG(buff);
+ emsg(buff);
break;
}
}