From e110a86cc514fad7fd183228975e024597f4fdef Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 20 Apr 2007 06:48:23 +0000 Subject: [PATCH] * eval.c (ruby_cleanup): inversed the order of errinfos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/eval.c b/eval.c index 3755c6b1a2..a5ac76e129 100644 --- a/eval.c +++ b/eval.c @@ -153,17 +153,17 @@ ruby_finalize(void) int ruby_cleanup(int ex) { - int state, nerr; - VALUE err; - rb_thread_t *th = GET_THREAD(); + int state; volatile VALUE errs[2]; + rb_thread_t *th = GET_THREAD(); rb_vm_t *vm = th->vm; + int nerr; - errs[0] = th->errinfo; + errs[1] = th->errinfo; th->safe_level = 0; Init_stack((void *)&state); ruby_finalize_0(); - errs[1] = th->errinfo; + errs[0] = th->errinfo; PUSH_THREAD_TAG(); if ((state = EXEC_TAG()) == 0) { rb_thread_terminate_all(); @@ -171,14 +171,16 @@ ruby_cleanup(int ex) else if (ex == 0) { ex = state; } - th->errinfo = errs[0]; + th->errinfo = errs[1]; ex = error_handle(ex); ruby_finalize_1(); POP_THREAD_TAG(); rb_thread_stop_timer_thread(); - for (nerr = sizeof(errs) / sizeof(errs[0]); nerr;) { - if (!RTEST(err = errs[--nerr])) continue; + for (nerr = 0; nerr < sizeof(errs) / sizeof(errs[0]); ++nerr) { + VALUE err = errs[nerr]; + + if (!RTEST(err)) continue; /* th->errinfo contains a NODE while break'ing */ if (TYPE(err) == T_NODE) continue;