ruby-changes:48263
From: nobu <ko1@a...>
Date: Mon, 23 Oct 2017 15:42:43 +0900 (JST)
Subject: [ruby-changes:48263] nobu:r60378 (trunk): error.c: warning to write multiple arguments
nobu 2017-10-23 15:42:37 +0900 (Mon, 23 Oct 2017) New Revision: 60378 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60378 Log: error.c: warning to write multiple arguments * error.c (warning_write): accepts multiple arguments to merge multiple warning messages. Modified files: trunk/error.c Index: error.c =================================================================== --- error.c (revision 60377) +++ error.c (revision 60378) @@ -300,6 +300,15 @@ end_with_asciichar(VALUE str, int c) https://github.com/ruby/ruby/blob/trunk/error.c#L300 rb_str_end_with_asciichar(str, c); } +static VALUE +warning_write(int argc, VALUE *argv, VALUE buf) +{ + while (argc-- > 0) { + rb_str_append(buf, *argv++); + } + return buf; +} + /* * call-seq: * warn(msg, ...) -> nil @@ -2246,7 +2255,7 @@ Init_Exception(void) https://github.com/ruby/ruby/blob/trunk/error.c#L2255 rb_extend_object(rb_mWarning, rb_mWarning); rb_cWarningBuffer = rb_define_class_under(rb_mWarning, "buffer", rb_cString); - rb_define_method(rb_cWarningBuffer, "write", rb_str_append, 1); + rb_define_method(rb_cWarningBuffer, "write", warning_write, -1); rb_define_global_function("warn", rb_warn_m, -1); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/