diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-24 08:25:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-24 08:25:44 +0000 |
commit | 26984290eb4f20a4a2db2b8d461cd36a4a5b0e49 (patch) | |
tree | b241540453b9f4cc72076850b3ca95287252d770 /error.c | |
parent | 8cda3cbb5678bad7a3fae3f9502bf882ac0d689b (diff) | |
download | ruby-26984290eb4f20a4a2db2b8d461cd36a4a5b0e49.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.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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", |