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

vm.c: clear intermediate hash

* vm.c (rb_f_local_variables): clear intermediate hash after
  extracting its keys.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-05-07 04:26:44 +00:00
parent d467227486
commit a1bc138fd0

View file

@ -1887,6 +1887,7 @@ static VALUE
rb_f_local_variables(void)
{
VALUE vars = rb_hash_new();
VALUE ary;
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));
@ -1924,7 +1925,9 @@ rb_f_local_variables(void)
}
/* TODO: rb_hash_keys() directly, or something not to depend on
* the order of st_table */
return rb_funcallv(vars, rb_intern("keys"), 0, 0);
ary = rb_funcallv(vars, rb_intern("keys"), 0, 0);
rb_hash_clear(vars);
return ary;
}
/*