From 6d11719b0ea795f572207429c56f54f4de25fa49 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 29 Oct 2017 15:38:55 +0000 Subject: [PATCH] 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 --- safe.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/safe.c b/safe.c index 540970c9f2..3575ecca15 100644 --- a/safe.c +++ b/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