aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-24 08:25:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-24 08:25:44 +0000
commit22742411548d8b8fad25c272aed0781e3218042a (patch)
treeb241540453b9f4cc72076850b3ca95287252d770 /error.c
parent843386848571da72c696b255551c612fe1d9b4ec (diff)
downloadruby-22742411548d8b8fad25c272aed0781e3218042a.tar.gz
preserve source file name encoding
* compile.c (append_compile_error), parse.y (compile_error): preserve encoding of source file name in exceptions. * error.c (rb_compile_error_str, rb_compile_bug_str): add. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/error.c b/error.c
index 0a7b2745a3..f2c86448e7 100644
--- a/error.c
+++ b/error.c
@@ -152,6 +152,20 @@ rb_compile_error(const char *file, int line, const char *fmt, ...)
}
void
+rb_compile_error_str(VALUE file, int line, void *enc, const char *fmt, ...)
+{
+ va_list args;
+ VALUE str;
+
+ va_start(args, fmt);
+ str = compile_snprintf(enc, NULL,
+ NIL_P(file) ? NULL : RSTRING_PTR(file), line,
+ fmt, args);
+ va_end(args);
+ compile_err_append(str);
+}
+
+void
rb_compile_error_append(const char *fmt, ...)
{
va_list args;
@@ -477,6 +491,14 @@ rb_compile_bug(const char *file, int line, const char *fmt, ...)
abort();
}
+void
+rb_compile_bug_str(VALUE file, int line, const char *fmt, ...)
+{
+ report_bug(RSTRING_PTR(file), line, fmt, NULL);
+
+ abort();
+}
+
static const char builtin_types[][10] = {
"", /* 0x00, */
"Object",