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

ruby-changes:33774

From: nobu <ko1@a...>
Date: Wed, 7 May 2014 13:27:11 +0900 (JST)
Subject: [ruby-changes:33774] nobu:r45857 (trunk): vm_eval.c: hide intermediate hash

nobu	2014-05-07 13:26:55 +0900 (Wed, 07 May 2014)

  New Revision: 45857

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

  Log:
    vm_eval.c: hide intermediate hash
    
    * vm_eval.c (rb_f_local_variables): hide intermediate hash and use
      rb_hash_keys() directly.

  Modified files:
    trunk/vm_eval.c
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 45856)
+++ vm_eval.c	(revision 45857)
@@ -1918,6 +1918,7 @@ rb_f_local_variables(void) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1918
 
     vars.tbl = rb_hash_new();
     RHASH(vars.tbl)->ntbl = st_init_numtable(); /* compare_by_identity */
+    RBASIC_CLEAR_CLASS(vars.tbl);
     while (cfp) {
 	if (cfp->iseq) {
 	    for (i = 0; i < cfp->iseq->local_table_size; i++) {
@@ -1941,9 +1942,8 @@ rb_f_local_variables(void) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1942
 	    break;
 	}
     }
-    /* TODO: rb_hash_keys() directly, or something not to depend on
-     * the order of st_table */
-    ary = rb_funcallv(vars.tbl, rb_intern("keys"), 0, 0);
+    /* TODO: not to depend on the order of st_table */
+    ary = rb_hash_keys(vars.tbl);
     rb_hash_clear(vars.tbl);
     return ary;
 }

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

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