Index: io.c =================================================================== --- io.c (revision 60366) +++ io.c (working copy) @@ -1730,6 +1730,12 @@ return rb_funcallv(io, id_write, 1, &str); } +VALUE +rb_io_writev(VALUE io, int argc, VALUE *argv) +{ + return rb_funcallv(io, id_write, argc, argv); +} + /* * call-seq: * ios << obj -> ios @@ -7586,6 +7592,25 @@ return Qtrue; } +void +io_puts_string(VALUE out, VALUE str) +{ + if (RSTRING_LEN(str) == 0 || !rb_str_end_with_asciichar(str, '\n')) { +#ifdef HAVE_WRITEV + VALUE args[2]; + args[0] = str; + args[1] = rb_default_rs; + rb_io_writev(out, 2, args); +#else + rb_io_write(out, str); + rb_io_write(out, rb_default_rs); +#endif + } + else { + rb_io_write(out, str); + } +} + /* * call-seq: * ios.puts(obj, ...) -> nil @@ -7617,28 +7642,23 @@ rb_io_puts(int argc, const VALUE *argv, VALUE out) { int i; - VALUE line; /* if no argument given, print newline. */ if (argc == 0) { - rb_io_write(out, rb_default_rs); - return Qnil; + rb_io_write(out, rb_default_rs); + return Qnil; } for (i=0; i