mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
io.c: let rb_p use writev
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7da5b32a7d
commit
1b27af8d56
1 changed files with 5 additions and 5 deletions
10
io.c
10
io.c
|
@ -7640,15 +7640,15 @@ rb_f_puts(int argc, VALUE *argv, VALUE recv)
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue