Project

General

Profile

Feature #5029 ยป 0001-Changed-rb_warn_m-to-accept-variable-arguments.patch

Changed rb_warn_m to accept variable arguments - boredomist (Erik Price), 07/17/2011 11:06 AM

View differences:

error.c
/*
* call-seq:
* warn(msg) -> nil
* warn(msg, ...) -> nil
*
* Display the given message (followed by a newline) on STDERR unless
* warnings are disabled (for example with the <code>-W0</code> flag).
* Displays each of the given messages followed by a record separator on
* STDERR unless warnings have been disabled (for example with the
* <code>-W0</code> flag).
*
* warn("warning 1", "warning 2")
*
* <em>produces:</em>
*
* warning 1
* warning 2
*/
static VALUE
rb_warn_m(VALUE self, VALUE mesg)
{
if (!NIL_P(ruby_verbose)) {
rb_io_write(rb_stderr, mesg);
rb_io_write(rb_stderr, rb_default_rs);
rb_warn_m(int argc, VALUE *argv, VALUE exc)
{
if (!NIL_P(ruby_verbose) && argc > 0) {
int i;
VALUE mesg;
for(i = 0; i < argc; ++i) {
mesg = argv[i];
rb_io_write(rb_stderr, mesg);
rb_io_write(rb_stderr, rb_default_rs);
}
}
return Qnil;
}
......
rb_mErrno = rb_define_module("Errno");
rb_define_global_function("warn", rb_warn_m, 1);
rb_define_global_function("warn", rb_warn_m, -1);
}
void
    (1-1/1)