diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-12 03:50:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-12 03:50:33 +0000 |
commit | a49068f1cbc5c7713f107726a37fbe8608fbe890 (patch) | |
tree | 555cb78d1be89ad3464928d5e021c1f6e8c85b7e /error.c | |
parent | d63802b375c6935113fb7bf9c48551be8aa58c4a (diff) | |
download | ruby-a49068f1cbc5c7713f107726a37fbe8608fbe890.tar.gz |
error.c: fix newline in syntax error
* error.c (rb_syntax_error_append): fix newline in syntax error
message to the beginning, not after file name and line number.
[Feature #11951]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -106,16 +106,16 @@ rb_syntax_error_append(VALUE exc, VALUE file, int line, int column, } else { VALUE mesg; - const char *pre = NULL; if (NIL_P(exc)) { mesg = rb_enc_str_new(0, 0, enc); exc = rb_class_new_instance(1, &mesg, rb_eSyntaxError); } else { mesg = rb_attr_get(exc, idMesg); - pre = "\n"; + if (RSTRING_LEN(mesg) > 0 && *(RSTRING_END(mesg)-1) != '\n') + rb_str_cat_cstr(mesg, "\n"); } - err_vcatf(mesg, pre, fn, line, fmt, args); + err_vcatf(mesg, NULL, fn, line, fmt, args); } return exc; |