diff src/if_ruby.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 1d2b5c016f17
children dd725a8ab112
line wrap: on
line diff
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -745,7 +745,7 @@ ruby_runtime_link_init(char *libname, in
     if (!hinstRuby)
     {
 	if (verbose)
-	    EMSG2(_(e_loadlib), libname);
+	    semsg(_(e_loadlib), libname);
 	return FAIL;
     }
 
@@ -757,7 +757,7 @@ ruby_runtime_link_init(char *libname, in
 	    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 @@ void ex_rubydo(exarg_T *eap)
 	    {
 		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 @@ static int ensure_ruby_initialized(void)
 	}
 	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 @@ static void error_print(int state)
     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 @@ static void error_print(int state)
 	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 @@ static void error_print(int state)
 		     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 @@ static void error_print(int state)
 	break;
     default:
 	vim_snprintf(buff, BUFSIZ, _("E273: unknown longjmp status %d"), state);
-	EMSG(buff);
+	emsg(buff);
 	break;
     }
 }