summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-19 14:52:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-19 14:52:43 +0000
commitbdfe0b8f18dc5642fbd8d50561c8e930cc18645d (patch)
treef814787bcd922c79a2bba3992660fbd9ad6a4ae8 /io.c
parenta3c76eb0c7d7b6d9ff51d42269486d59e5ac809f (diff)
* io.c (rb_io_putc, rb_io_puts): ouput directly if the reciever is
rb_stdout to get rid of infinite recursion. [ruby-dev:34059] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/io.c b/io.c
index 1f2af9fb25..cd1c590c41 100644
--- a/io.c
+++ b/io.c
@@ -4485,6 +4485,9 @@ rb_io_putc(VALUE io, VALUE ch)
static VALUE
rb_f_putc(VALUE recv, VALUE ch)
{
+ if (recv == rb_stdout) {
+ return rb_io_putc(recv, ch);
+ }
return rb_funcall2(rb_stdout, rb_intern("putc"), 1, &ch);
}
@@ -4562,8 +4565,11 @@ rb_io_puts(int argc, VALUE *argv, VALUE out)
*/
static VALUE
-rb_f_puts(int argc, VALUE *argv)
+rb_f_puts(int argc, VALUE *argv, VALUE recv)
{
+ if (recv == rb_stdout) {
+ return rb_io_puts(argc, argv, recv);
+ }
return rb_funcall2(rb_stdout, rb_intern("puts"), argc, argv);
}