refactor: make get_local_variable_ptr accept "rb_env_t *"
... instead of "rb_env_t **" because no one uses the updated env.
This commit is contained in:
parent
39960cd748
commit
6d75599a1a
Notes:
git
2025-02-18 07:23:41 +00:00
12
proc.c
12
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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user