diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-20 01:02:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-20 01:02:37 +0000 |
commit | 1d4976c0cf6ebf321f61f6fe83bf91f7fe101d8d (patch) | |
tree | 38bc6da68ed33681de01d779075e7736af479e48 /error.c | |
parent | 0ec889d7ed34f80b534dfc7a93bdd3175aba9ff9 (diff) |
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
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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); |