[前][次][番号順一覧][スレッド一覧]

ruby-changes:34566

From: nobu <ko1@a...>
Date: Wed, 2 Jul 2014 02:55:50 +0900 (JST)
Subject: [ruby-changes:34566] nobu:r46647 (trunk): vm.c: constify

nobu	2014-07-02 02:55:44 +0900 (Wed, 02 Jul 2014)

  New Revision: 46647

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46647

  Log:
    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.

  Modified files:
    trunk/vm.c
    trunk/vm_eval.c
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 46646)
+++ vm_eval.c	(revision 46647)
@@ -22,7 +22,7 @@ static inline VALUE vm_yield_with_block( https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L22
 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);
Index: vm.c
===================================================================
--- vm.c	(revision 46646)
+++ vm.c	(revision 46647)
@@ -453,8 +453,8 @@ check_env_value(VALUE envval) https://github.com/ruby/ruby/blob/trunk/vm.c#L453
 }
 
 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, https://github.com/ruby/ruby/blob/trunk/vm.c#L532
 }
 
 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_ https://github.com/ruby/ruby/blob/trunk/vm.c#L542
     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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]