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

ruby-changes:48311

From: nobu <ko1@a...>
Date: Wed, 25 Oct 2017 21:33:47 +0900 (JST)
Subject: [ruby-changes:48311] nobu:r60425 (trunk): io.c: let rb_p use writev

nobu	2017-10-25 21:33:42 +0900 (Wed, 25 Oct 2017)

  New Revision: 60425

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60425

  Log:
    io.c: let rb_p use writev

  Modified files:
    trunk/io.c
Index: io.c
===================================================================
--- io.c	(revision 60424)
+++ io.c	(revision 60425)
@@ -7640,15 +7640,15 @@ rb_f_puts(int argc, VALUE *argv, VALUE r https://github.com/ruby/ruby/blob/trunk/io.c#L7640
 void
 rb_p(VALUE obj) /* for debug print within C code */
 {
-    VALUE str = rb_obj_as_string(rb_inspect(obj));
+    VALUE args[2];
+    args[0] = rb_obj_as_string(rb_inspect(obj));
+    args[1] = rb_default_rs;
     if (RB_TYPE_P(rb_stdout, T_FILE) &&
         rb_method_basic_definition_p(CLASS_OF(rb_stdout), id_write)) {
-        io_write(rb_stdout, str, 1);
-        io_write(rb_stdout, rb_default_rs, 0);
+	io_writev(2, args, rb_stdout);
     }
     else {
-        rb_io_write(rb_stdout, str);
-        rb_io_write(rb_stdout, rb_default_rs);
+	rb_io_writev(rb_stdout, 2, args);
     }
 }
 

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

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