summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorYusuke Endoh <[email protected]>2025-01-20 17:35:12 +0900
committerYusuke Endoh <[email protected]>2025-02-18 16:23:24 +0900
commit6d75599a1aade9f8081d0691a9da1e62a5428e95 (patch)
tree32a7b3d3bc54c06fb52530010d59df140e67a13a /proc.c
parent39960cd748e969dd2bc711a7913fe4c0b00e7fd4 (diff)
refactor: make get_local_variable_ptr accept "rb_env_t *"
... instead of "rb_env_t **" because no one uses the updated env.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12746
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/proc.c b/proc.c
index 06bfaf9b81..e7e011a415 100644
--- a/proc.c
+++ b/proc.c
@@ -404,9 +404,8 @@ bind_eval(int argc, VALUE *argv, VALUE bindval)
}
static const VALUE *
-get_local_variable_ptr(const rb_env_t **envp, ID lid)
+get_local_variable_ptr(const rb_env_t *env, ID lid)
{
- const rb_env_t *env = *envp;
do {
if (!VM_ENV_FLAGS(env->ep, VM_FRAME_FLAG_CFRAME)) {
if (VM_ENV_FLAGS(env->ep, VM_ENV_FLAG_ISOLATED)) {
@@ -430,7 +429,6 @@ get_local_variable_ptr(const rb_env_t **envp, ID lid)
}
}
- *envp = env;
unsigned int last_lvar = env->env_size+VM_ENV_INDEX_LAST_LVAR
- 1 /* errinfo */;
return &env->env[last_lvar - (local_table_size - i)];
@@ -438,12 +436,10 @@ get_local_variable_ptr(const rb_env_t **envp, ID lid)
}
}
else {
- *envp = NULL;
return NULL;
}
} while ((env = rb_vm_env_prev_env(env)) != NULL);
- *envp = NULL;
return NULL;
}
@@ -533,7 +529,7 @@ bind_local_variable_get(VALUE bindval, VALUE sym)
GetBindingPtr(bindval, bind);
env = VM_ENV_ENVVAL_PTR(vm_block_ep(&bind->block));
- if ((ptr = get_local_variable_ptr(&env, lid)) != NULL) {
+ if ((ptr = get_local_variable_ptr(env, lid)) != NULL) {
return *ptr;
}
@@ -581,7 +577,7 @@ bind_local_variable_set(VALUE bindval, VALUE sym, VALUE val)
GetBindingPtr(bindval, bind);
env = VM_ENV_ENVVAL_PTR(vm_block_ep(&bind->block));
- if ((ptr = get_local_variable_ptr(&env, lid)) == NULL) {
+ if ((ptr = get_local_variable_ptr(env, lid)) == NULL) {
/* not found. create new env */
ptr = rb_binding_add_dynavars(bindval, bind, 1, &lid);
env = VM_ENV_ENVVAL_PTR(vm_block_ep(&bind->block));
@@ -624,7 +620,7 @@ bind_local_variable_defined_p(VALUE bindval, VALUE sym)
GetBindingPtr(bindval, bind);
env = VM_ENV_ENVVAL_PTR(vm_block_ep(&bind->block));
- return RBOOL(get_local_variable_ptr(&env, lid));
+ return RBOOL(get_local_variable_ptr(env, lid));
}
/*