merge revision(s) 49386:

hash.c: move Hash specific functions

	* hash.c (rb_ident_hash): move compare_by_identity specific
  function from st.c.

	* hash.c (rb_ident_hash_new): ditto from thread.c.

	* st.c (st_numhash): remove ruby's Hash specific implementation.

	* thread.c (recursive_list_access): use rb_ident_hash_new().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2015-02-20 13:53:23 +00:00
parent 310ab79f53
commit c93b7404c1
5 changed files with 47 additions and 37 deletions

View file

@ -4679,14 +4679,6 @@ rb_thread_shield_destroy(VALUE self)
return rb_thread_shield_waiting(self) > 0 ? Qtrue : Qfalse;
}
static VALUE
ident_hash_new(void)
{
VALUE hash = rb_hash_new();
rb_hash_tbl_raw(hash)->type = &st_hashtype_num;
return hash;
}
static VALUE
threadptr_recursive_hash(rb_thread_t *th)
{
@ -4714,7 +4706,7 @@ recursive_list_access(VALUE sym)
VALUE hash = threadptr_recursive_hash(th);
VALUE list;
if (NIL_P(hash) || !RB_TYPE_P(hash, T_HASH)) {
hash = ident_hash_new();
hash = rb_ident_hash_new();
threadptr_recursive_hash_set(th, hash);
list = Qnil;
}
@ -4722,7 +4714,7 @@ recursive_list_access(VALUE sym)
list = rb_hash_aref(hash, sym);
}
if (NIL_P(list) || !RB_TYPE_P(list, T_HASH)) {
list = ident_hash_new();
list = rb_ident_hash_new();
rb_hash_aset(hash, sym, list);
}
return list;