summaryrefslogtreecommitdiff
path: root/safe.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-29 15:38:55 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-29 15:38:55 +0000
commit6d11719b0ea795f572207429c56f54f4de25fa49 (patch)
treeb3c598324a820f74ffa1ae4048722c8ffbfd0fb2 /safe.c
parent735129aa90f6e5675fd0b11f2354fc0d61817fd5 (diff)
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
Diffstat (limited to 'safe.c')
-rw-r--r--safe.c17
1 files 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