mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
aeaeb4b068
commit
cf4351f82a
1 changed files with 10 additions and 1 deletions
11
error.c
11
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue