зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
f56a2c7293
Коммит
53d5f865e6
2
eval.c
2
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);
|
||||
}
|
||||
}
|
||||
|
|
11
eval_error.c
11
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче