Skip to content

Commit 6d75599

Browse files
committed
refactor: make get_local_variable_ptr accept "rb_env_t *"
... instead of "rb_env_t **" because no one uses the updated env.
1 parent 39960cd commit 6d75599

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

proc.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,8 @@ bind_eval(int argc, VALUE *argv, VALUE bindval)
404404
}
405405

406406
static const VALUE *
407-
get_local_variable_ptr(const rb_env_t **envp, ID lid)
407+
get_local_variable_ptr(const rb_env_t *env, ID lid)
408408
{
409-
const rb_env_t *env = *envp;
410409
do {
411410
if (!VM_ENV_FLAGS(env->ep, VM_FRAME_FLAG_CFRAME)) {
412411
if (VM_ENV_FLAGS(env->ep, VM_ENV_FLAG_ISOLATED)) {
@@ -430,20 +429,17 @@ get_local_variable_ptr(const rb_env_t **envp, ID lid)
430429
}
431430
}
432431

433-
*envp = env;
434432
unsigned int last_lvar = env->env_size+VM_ENV_INDEX_LAST_LVAR
435433
- 1 /* errinfo */;
436434
return &env->env[last_lvar - (local_table_size - i)];
437435
}
438436
}
439437
}
440438
else {
441-
*envp = NULL;
442439
return NULL;
443440
}
444441
} while ((env = rb_vm_env_prev_env(env)) != NULL);
445442

446-
*envp = NULL;
447443
return NULL;
448444
}
449445

@@ -533,7 +529,7 @@ bind_local_variable_get(VALUE bindval, VALUE sym)
533529
GetBindingPtr(bindval, bind);
534530

535531
env = VM_ENV_ENVVAL_PTR(vm_block_ep(&bind->block));
536-
if ((ptr = get_local_variable_ptr(&env, lid)) != NULL) {
532+
if ((ptr = get_local_variable_ptr(env, lid)) != NULL) {
537533
return *ptr;
538534
}
539535

@@ -581,7 +577,7 @@ bind_local_variable_set(VALUE bindval, VALUE sym, VALUE val)
581577

582578
GetBindingPtr(bindval, bind);
583579
env = VM_ENV_ENVVAL_PTR(vm_block_ep(&bind->block));
584-
if ((ptr = get_local_variable_ptr(&env, lid)) == NULL) {
580+
if ((ptr = get_local_variable_ptr(env, lid)) == NULL) {
585581
/* not found. create new env */
586582
ptr = rb_binding_add_dynavars(bindval, bind, 1, &lid);
587583
env = VM_ENV_ENVVAL_PTR(vm_block_ep(&bind->block));
@@ -624,7 +620,7 @@ bind_local_variable_defined_p(VALUE bindval, VALUE sym)
624620

625621
GetBindingPtr(bindval, bind);
626622
env = VM_ENV_ENVVAL_PTR(vm_block_ep(&bind->block));
627-
return RBOOL(get_local_variable_ptr(&env, lid));
623+
return RBOOL(get_local_variable_ptr(env, lid));
628624
}
629625

630626
/*

0 commit comments

Comments
 (0)