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

ruby-changes:33767

From: nobu <ko1@a...>
Date: Wed, 7 May 2014 11:00:37 +0900 (JST)
Subject: [ruby-changes:33767] nobu:r45848 (trunk): rename variables

nobu	2014-05-07 11:00:28 +0900 (Wed, 07 May 2014)

  New Revision: 45848

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

  Log:
    rename variables
    
    * vm.c (vm_collect_local_variables_in_heap): rename an argument.
    
    * vm_eval.c (rb_f_local_variables): rename a local variable.

  Modified files:
    trunk/vm.c
    trunk/vm_eval.c
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 45847)
+++ vm_eval.c	(revision 45848)
@@ -18,7 +18,7 @@ static inline VALUE vm_yield_with_block( https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L18
 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, VALUE ary);
+static int vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *dfp, VALUE vars);
 
 /* vm_backtrace.c */
 VALUE rb_vm_backtrace_str_ary(rb_thread_t *th, int lev, int n);
@@ -1886,7 +1886,7 @@ rb_catch_protect(VALUE t, rb_block_call_ https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1886
 static VALUE
 rb_f_local_variables(void)
 {
-    VALUE ary = rb_ary_new();
+    VALUE vars = rb_ary_new();
     rb_thread_t *th = GET_THREAD();
     rb_control_frame_t *cfp =
 	vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp));
@@ -1900,7 +1900,7 @@ rb_f_local_variables(void) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1900
 		    const char *vname = rb_id2name(lid);
 		    /* should skip temporary variable */
 		    if (vname) {
-			rb_ary_push(ary, ID2SYM(lid));
+			rb_ary_push(vars, ID2SYM(lid));
 		    }
 		}
 	    }
@@ -1909,7 +1909,7 @@ rb_f_local_variables(void) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1909
 	    /* block */
 	    VALUE *ep = VM_CF_PREV_EP(cfp);
 
-	    if (vm_collect_local_variables_in_heap(th, ep, ary)) {
+	    if (vm_collect_local_variables_in_heap(th, ep, vars)) {
 		break;
 	    }
 	    else {
@@ -1922,7 +1922,7 @@ rb_f_local_variables(void) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1922
 	    break;
 	}
     }
-    return ary;
+    return vars;
 }
 
 /*
Index: vm.c
===================================================================
--- vm.c	(revision 45847)
+++ vm.c	(revision 45848)
@@ -516,24 +516,24 @@ vm_make_env_each(rb_thread_t * const th, https://github.com/ruby/ruby/blob/trunk/vm.c#L516
 }
 
 static int
-collect_local_variables_in_iseq(rb_iseq_t *iseq, const VALUE ary)
+collect_local_variables_in_iseq(rb_iseq_t *iseq, const VALUE vars)
 {
     int i;
     if (!iseq) return 0;
     for (i = 0; i < iseq->local_table_size; i++) {
 	ID lid = iseq->local_table[i];
 	if (rb_is_local_id(lid)) {
-	    rb_ary_push(ary, ID2SYM(lid));
+	    rb_ary_push(vars, ID2SYM(lid));
 	}
     }
     return 1;
 }
 
 static int
-collect_local_variables_in_env(rb_env_t * env, const VALUE ary)
+collect_local_variables_in_env(rb_env_t *env, const VALUE vars)
 {
 
-    while (collect_local_variables_in_iseq(env->block.iseq, ary),
+    while (collect_local_variables_in_iseq(env->block.iseq, vars),
 	   env->prev_envval) {
 	GetEnvPtr(env->prev_envval, env);
     }
@@ -541,12 +541,12 @@ collect_local_variables_in_env(rb_env_t https://github.com/ruby/ruby/blob/trunk/vm.c#L541
 }
 
 static int
-vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *ep, VALUE ary)
+vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *ep, VALUE vars)
 {
     if (ENV_IN_HEAP_P(th, ep)) {
 	rb_env_t *env;
 	GetEnvPtr(ENV_VAL(ep), env);
-	collect_local_variables_in_env(env, ary);
+	collect_local_variables_in_env(env, vars);
 	return 1;
     }
     else {

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

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