aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-19 06:25:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-19 06:25:06 +0000
commit98cf54a4b55b65dbd8af2a86a572f02afb1701b8 (patch)
tree5d2b13d84e3681be40d9fbd47a5b31cdb2055587 /io.c
parent11aea79b64ed1b78c12b554cab5a4480d161fe9c (diff)
downloadruby-98cf54a4b55b65dbd8af2a86a572f02afb1701b8.tar.gz
Change Kernel#warn to call Warning.warn
This allows Warning.warn to filter/process warning messages generated by Kernel#warn. Currently, Warning.warn can only handle messages generated by the rb_warn/rb_warning C functions. The Kernel#warn API is different than the Warning.warn API, this tries to get similar behavior, but there are probably corner cases where the behavior is different. This makes str_end_with_asciichar in io.c no longer static so it can be called from error.c. [Feature #12944] Author: Jeremy Evans <code@jeremyevans.net> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/io.c b/io.c
index 1074689560..4bcddf4cf9 100644
--- a/io.c
+++ b/io.c
@@ -7124,8 +7124,8 @@ rb_f_putc(VALUE recv, VALUE ch)
}
-static int
-str_end_with_asciichar(VALUE str, int c)
+int
+rb_str_end_with_asciichar(VALUE str, int c)
{
long len = RSTRING_LEN(str);
const char *ptr = RSTRING_PTR(str);
@@ -7202,7 +7202,7 @@ rb_io_puts(int argc, const VALUE *argv, VALUE out)
string:
rb_io_write(out, line);
if (RSTRING_LEN(line) == 0 ||
- !str_end_with_asciichar(line, '\n')) {
+ !rb_str_end_with_asciichar(line, '\n')) {
rb_io_write(out, rb_default_rs);
}
}