error.c: print default RS
* error.c (rb_warn_m): print the default RS instead of an empty string with a newline. [Feature #12944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0ec889d7ed
commit
1d4976c0cf
5
error.c
5
error.c
@ -303,7 +303,10 @@ rb_warn_m(int argc, VALUE *argv, VALUE exc)
|
||||
VALUE str;
|
||||
for (i = 0; i < argc; i++) {
|
||||
str = rb_obj_as_string(argv[i]);
|
||||
if (RSTRING_LEN(str) == 0 || !rb_str_end_with_asciichar(str, '\n')) {
|
||||
if (RSTRING_LEN(str) == 0) {
|
||||
str = rb_default_rs;
|
||||
}
|
||||
else if (!rb_str_end_with_asciichar(str, '\n')) {
|
||||
str = rb_str_cat(rb_str_dup(str), "\n", 1);
|
||||
}
|
||||
rb_write_warning_str(str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user