aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-23 06:42:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-23 06:42:37 +0000
commitf6c42257502df6cba9edc427c4cb2e61f1cfe167 (patch)
treed2c80970fe6cb792abece02bb922ae24fef11461 /error.c
parent5b33e72ae765946cc9cbdded524f0e11ce053e58 (diff)
downloadruby-f6c42257502df6cba9edc427c4cb2e61f1cfe167.tar.gz
error.c: warning to write multiple arguments
* error.c (warning_write): accepts multiple arguments to merge multiple warning messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/error.c b/error.c
index 9bd8c31386..668bc9bfa8 100644
--- a/error.c
+++ b/error.c
@@ -300,6 +300,15 @@ end_with_asciichar(VALUE str, int c)
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)
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);