1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

eval_error.c: reduce setjmp

* eval_error.c (error_print): reduce calling setjmp.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-06-10 06:34:28 +00:00
parent c2b4f88fcb
commit 222d028808
2 changed files with 14 additions and 7 deletions

View file

@ -1,3 +1,7 @@
Mon Jun 10 15:34:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval_error.c (error_print): reduce calling setjmp.
Mon Jun 10 12:10:06 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (integer_unpack_num_bdigits_small: Extracted from

View file

@ -78,11 +78,11 @@ set_backtrace(VALUE info, VALUE bt)
static void
error_print(void)
{
volatile VALUE errat = Qnil; /* OK */
volatile VALUE errat = Qundef;
rb_thread_t *th = GET_THREAD();
VALUE errinfo = th->errinfo;
int raised_flag = th->raised_flag;
volatile VALUE eclass, e;
volatile VALUE eclass = Qundef, e = Qundef;
const char *volatile einfo;
volatile long elen;
@ -94,11 +94,15 @@ error_print(void)
if (TH_EXEC_TAG() == 0) {
errat = get_backtrace(errinfo);
}
else {
else if (errat == Qundef) {
errat = Qnil;
}
if (TH_EXEC_TAG())
else if (eclass == Qundef || e != Qundef) {
goto error;
}
else {
goto no_message;
}
if (NIL_P(errat)) {
const char *file = rb_sourcefile();
int line = rb_sourceline();
@ -123,18 +127,17 @@ error_print(void)
}
eclass = CLASS_OF(errinfo);
if (TH_EXEC_TAG() == 0) {
if (eclass != Qundef) {
e = rb_funcall(errinfo, rb_intern("message"), 0, 0);
StringValue(e);
einfo = RSTRING_PTR(e);
elen = RSTRING_LEN(e);
}
else {
no_message:
einfo = "";
elen = 0;
}
if (TH_EXEC_TAG())
goto error;
if (eclass == rb_eRuntimeError && elen == 0) {
warn_print(": unhandled exception\n");
}