aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-23 03:23:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-23 03:23:28 +0000
commit53d5f865e65ce7f40b986f3d77f0b99d1ffab38b (patch)
tree1e26d10ad114b7ecda1476a39935a6847f48b5db
parentf56a2c72939e8caacbfc87f12fba49b55d4dcaa9 (diff)
downloadruby-53d5f865e65ce7f40b986f3d77f0b99d1ffab38b.tar.gz
eval_error.c: reuse threadptr
* eval_error.c (error_print, error_handle): reuse same threadptr by passing as an argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--eval.c2
-rw-r--r--eval_error.c11
2 files changed, 6 insertions, 7 deletions
diff --git a/eval.c b/eval.c
index 47cfd6107c..66db86757f 100644
--- a/eval.c
+++ b/eval.c
@@ -76,7 +76,7 @@ ruby_init(void)
int state = ruby_setup();
if (state) {
if (RTEST(ruby_debug))
- error_print();
+ error_print(GET_THREAD());
exit(EXIT_FAILURE);
}
}
diff --git a/eval_error.c b/eval_error.c
index 69090fdf50..c3e7c25e67 100644
--- a/eval_error.c
+++ b/eval_error.c
@@ -87,10 +87,9 @@ set_backtrace(VALUE info, VALUE bt)
}
static void
-error_print(void)
+error_print(rb_thread_t *th)
{
volatile VALUE errat = Qundef;
- rb_thread_t *th = GET_THREAD();
VALUE errinfo = th->errinfo;
int raised_flag = th->raised_flag;
volatile VALUE eclass = Qundef, e = Qundef;
@@ -200,7 +199,7 @@ error_print(void)
void
ruby_error_print(void)
{
- error_print();
+ error_print(GET_THREAD());
}
#define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%2$s'")
@@ -301,7 +300,7 @@ error_handle(int ex)
warn_print("unexpected throw\n");
break;
case TAG_RAISE: {
- VALUE errinfo = GET_THREAD()->errinfo;
+ VALUE errinfo = th->errinfo;
if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
status = sysexit_status(errinfo);
}
@@ -310,12 +309,12 @@ error_handle(int ex)
/* no message when exiting by signal */
}
else {
- error_print();
+ error_print(th);
}
break;
}
case TAG_FATAL:
- error_print();
+ error_print(th);
break;
default:
unknown_longjmp_status(ex);