summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-17 14:58:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-17 14:58:47 +0000
commit743d7affda9cea2172d187aafe7dc98b5bd80f64 (patch)
tree340671f67223398e599db22a20a9fb3e3211f5a5 /eval.c
parent311d02a322cf38b85405613e50ce36c3e5eaec6d (diff)
* 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
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c19
1 files changed, 9 insertions, 10 deletions
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: