[前][次][番号順一覧][スレッド一覧]

ruby-changes:4318

From: ko1@a...
Date: Wed, 19 Mar 2008 23:53:11 +0900 (JST)
Subject: [ruby-changes:4318] nobu - Ruby:r15808 (trunk): * io.c (rb_io_putc, rb_io_puts): ouput directly if the reciever is

nobu	2008-03-19 23:52:43 +0900 (Wed, 19 Mar 2008)

  New Revision: 15808

  Modified files:
    trunk/ChangeLog
    trunk/io.c

  Log:
    * 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]


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15808&r2=15807&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=15808&r2=15807&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15807)
+++ ChangeLog	(revision 15808)
@@ -1,3 +1,8 @@
+Wed Mar 19 23:52:41 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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]
+
 Wed Mar 19 22:27:41 2008  Tadayoshi Funaba  <tadf@d...>
 
 	* rational.c: added rb_gcd.
Index: io.c
===================================================================
--- io.c	(revision 15807)
+++ io.c	(revision 15808)
@@ -4485,6 +4485,9 @@
 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 @@
  */
 
 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);
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]