Project

General

Profile

Bug #5728 ยป system-exit-bool.patch

akr (Akira Tanaka), 12/11/2011 02:24 AM

View differences:

error.c (working copy)
/*
* call-seq:
* SystemExit.new -> system_exit
* SystemExit.new(status) -> system_exit
* SystemExit.new(status, msg) -> system_exit
* SystemExit.new(msg) -> system_exit
* SystemExit.new -> system_exit
* SystemExit.new(status) -> system_exit
* SystemExit.new(status, message) -> system_exit
* SystemExit.new(msg) -> system_exit
*
* Create a new +SystemExit+ exception with the given _status_ and _message_.
* If _status_ is not given, EXIT_SUCCESS is used.
*
* _status_ should be +true+, +false+ or an integer.
* +true+ means EXIT_SUCCESS and +false+ means EXIT_FAILURE.
*
* _message_ should be a string.
*
* Create a new +SystemExit+ exception with the given status and message.
* If status is not given, EXIT_SUCCESS is used.
*/
static VALUE
exit_initialize(int argc, VALUE *argv, VALUE exc)
{
VALUE status = INT2FIX(EXIT_SUCCESS);
if (argc > 0 && FIXNUM_P(argv[0])) {
status = *argv++;
if (argc > 0 && (FIXNUM_P(argv[0]) || argv[0] == Qtrue || argv[0] == Qfalse)) {
if (argv[0] == Qtrue)
status = INT2FIX(EXIT_SUCCESS);
else if (argv[0] == Qfalse)
status = INT2FIX(EXIT_FAILURE);
else
status = *argv++;
--argc;
}
rb_call_super(argc, argv);
    (1-1/1)