From 743d7affda9cea2172d187aafe7dc98b5bd80f64 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@9000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 3197412bca..a0b31db0dd 100644 --- a/eval.c +++ b/eval.c @@ -4352,16 +4352,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)); } @@ -4371,7 +4370,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); @@ -4476,9 +4475,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 */ } @@ -10489,7 +10488,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 v1.2.3