1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vm.c: constify

* vm.c (vm_make_env_each): constify pointer arguments.
  (collect_local_variables_in_iseq): ditto.
  (collect_local_variables_in_env): ditto.
  (vm_collect_local_variables_in_heap): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-07-01 17:55:44 +00:00
parent 43ba2c01e7
commit 0fdb18e513
2 changed files with 7 additions and 8 deletions

13
vm.c
View file

@ -453,8 +453,8 @@ check_env_value(VALUE envval)
}
static VALUE
vm_make_env_each(rb_thread_t * const th, rb_control_frame_t * const cfp,
VALUE *envptr, VALUE * const endptr)
vm_make_env_each(const rb_thread_t *const th, rb_control_frame_t *const cfp,
VALUE *envptr, const VALUE *const endptr)
{
VALUE envval, penvval = 0;
rb_env_t *env;
@ -532,7 +532,7 @@ vm_make_env_each(rb_thread_t * const th, rb_control_frame_t * const cfp,
}
static int
collect_local_variables_in_iseq(rb_iseq_t *iseq, const struct local_var_list *vars)
collect_local_variables_in_iseq(const rb_iseq_t *iseq, const struct local_var_list *vars)
{
int i;
if (!iseq) return 0;
@ -542,19 +542,18 @@ collect_local_variables_in_iseq(rb_iseq_t *iseq, const struct local_var_list *va
return 1;
}
static int
collect_local_variables_in_env(rb_env_t *env, const struct local_var_list *vars)
static void
collect_local_variables_in_env(const rb_env_t *env, const struct local_var_list *vars)
{
while (collect_local_variables_in_iseq(env->block.iseq, vars),
env->prev_envval) {
GetEnvPtr(env->prev_envval, env);
}
return 0;
}
static int
vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *ep, const struct local_var_list *vars)
vm_collect_local_variables_in_heap(rb_thread_t *th, const VALUE *ep, const struct local_var_list *vars)
{
if (ENV_IN_HEAP_P(th, ep)) {
rb_env_t *env;

View file

@ -22,7 +22,7 @@ static inline VALUE vm_yield_with_block(rb_thread_t *th, int argc, const VALUE *
static NODE *vm_cref_push(rb_thread_t *th, VALUE klass, int noex, rb_block_t *blockptr);
static VALUE vm_exec(rb_thread_t *th);
static void vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const NODE *cref, rb_block_t *base_block);
static int vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *dfp, const struct local_var_list *vars);
static int vm_collect_local_variables_in_heap(rb_thread_t *th, const VALUE *dfp, const struct local_var_list *vars);
/* vm_backtrace.c */
VALUE rb_vm_backtrace_str_ary(rb_thread_t *th, int lev, int n);