зеркало из https://github.com/github/ruby.git
call `rb_vm_stack_to_heap()`
* safe.c (rb_set_safe_level): call `rb_vm_stack_to_heap()` to set block parameter. * safe.c (rb_set_safe_level): use `GET_EC()`. * safe.c (safe_setter): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
735129aa90
Коммит
6d11719b0e
17
safe.c
17
safe.c
|
@ -46,13 +46,16 @@ rb_set_safe_level_force(int safe)
|
|||
void
|
||||
rb_set_safe_level(int level)
|
||||
{
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
rb_execution_context_t *ec = GET_EC();
|
||||
|
||||
if (level > th->ec->safe_level) {
|
||||
if (level > ec->safe_level) {
|
||||
if (level > SAFE_LEVEL_MAX) {
|
||||
rb_raise(rb_eArgError, "$SAFE=2 to 4 are obsolete");
|
||||
}
|
||||
th->ec->safe_level = level;
|
||||
/* block parameters */
|
||||
rb_vm_stack_to_heap(ec);
|
||||
|
||||
ec->safe_level = level;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,8 +68,8 @@ safe_getter(void)
|
|||
static void
|
||||
safe_setter(VALUE val)
|
||||
{
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
int current_level = th->ec->safe_level;
|
||||
rb_execution_context_t *ec = GET_EC();
|
||||
int current_level = ec->safe_level;
|
||||
int level = NUM2INT(val);
|
||||
|
||||
if (level == current_level) {
|
||||
|
@ -82,9 +85,9 @@ safe_setter(VALUE val)
|
|||
}
|
||||
|
||||
/* block parameters */
|
||||
rb_vm_stack_to_heap(th->ec);
|
||||
rb_vm_stack_to_heap(ec);
|
||||
|
||||
th->ec->safe_level = level;
|
||||
ec->safe_level = level;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче