From 942903a0c2e46871d9659d75fbb77f87f07db1f2 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 17 Aug 2005 14:58:47 +0000 Subject: * eval.c (terminate_process): take String message. * eval.c (rb_thread_switch): propagate the exception caused thread termination directly. fixed: [ruby-core:05552] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 ++++++- eval.c | 19 +++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 232bad6d0..ebd14b6c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,12 @@ -Mon Aug 15 07:24:38 2005 Nobuyoshi Nakada +Wed Aug 17 23:58:05 2005 Nobuyoshi Nakada * object.c (rb_to_integer): argument constified. + * eval.c (terminate_process): take String message. + + * eval.c (rb_thread_switch): propagate the exception caused thread + termination directly. fixed: [ruby-core:05552] + Mon Aug 15 00:38:51 2005 Nobuyoshi Nakada * eval.c (rb_rescue2): reduce PUSH_TAG() as well as NODE_RESCUE. diff --git a/eval.c b/eval.c index 6edc3149f..274e27451 100644 --- a/eval.c +++ b/eval.c @@ -4281,16 +4281,15 @@ rb_mod_protected_method_defined(mod, mid) return Qfalse; } -NORETURN(static VALUE terminate_process _((int, const char *, long))); +NORETURN(static VALUE terminate_process _((int, VALUE))); static VALUE -terminate_process(status, mesg, mlen) +terminate_process(status, mesg) int status; - const char *mesg; - long mlen; + VALUE mesg; { VALUE args[2]; args[0] = INT2NUM(status); - args[1] = rb_str_new(mesg, mlen); + args[1] = mesg; rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit)); } @@ -4300,7 +4299,7 @@ rb_exit(status) int status; { if (prot_tag) { - terminate_process(status, "exit", 4); + terminate_process(status, rb_str_new("exit", 4)); } ruby_finalize(); exit(status); @@ -4405,9 +4404,9 @@ rb_f_abort(argc, argv) VALUE mesg; rb_scan_args(argc, argv, "1", &mesg); - StringValue(argv[0]); - rb_io_puts(argc, argv, rb_stderr); - terminate_process(EXIT_FAILURE, RSTRING(argv[0])->ptr, RSTRING(argv[0])->len); + StringValue(mesg); + rb_io_puts(1, &mesg, rb_stderr); + terminate_process(EXIT_FAILURE, mesg); } return Qnil; /* not reached */ } @@ -10070,7 +10069,7 @@ rb_thread_switch(n) case RESTORE_EXIT: ruby_errinfo = th_raise_exception; ruby_current_node = th_raise_node; - terminate_process(sysexit_status(ruby_errinfo), 0, 0); + rb_exc_raise(th_raise_exception); break; case RESTORE_NORMAL: default: -- cgit