diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-06 07:50:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-06 07:50:19 +0000 |
commit | c7572f2fe777c96880905ee37ab313cd52b5aa51 (patch) | |
tree | ca41223b31e7793c4ae5d33ed9e1d5688a8cacfa /thread.c | |
parent | 378d20f80d74a142aa30c27e1f7412d48c650f84 (diff) | |
download | ruby-c7572f2fe777c96880905ee37ab313cd52b5aa51.tar.gz |
thread.c: compare_by_id
* thread.c (recursive_list_access): let symbol only hashes compare
the elements by id.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -4738,6 +4738,16 @@ rb_thread_shield_destroy(VALUE self) /* variables for recursive traversals */ static ID recursive_key; +extern const struct st_hash_type st_hashtype_num; + +static VALUE +ident_hash_new(void) +{ + VALUE hash = rb_hash_new(); + rb_hash_tbl_raw(hash)->type = &st_hashtype_num; + return hash; +} + /* * Returns the current "recursive list" used to detect recursion. * This list is a hash table, unique for the current thread and for @@ -4751,7 +4761,7 @@ recursive_list_access(void) VALUE sym = ID2SYM(rb_frame_this_func()); VALUE list; if (NIL_P(hash) || !RB_TYPE_P(hash, T_HASH)) { - hash = rb_hash_new(); + hash = ident_hash_new(); rb_thread_local_aset(rb_thread_current(), recursive_key, hash); list = Qnil; } @@ -4759,7 +4769,7 @@ recursive_list_access(void) list = rb_hash_aref(hash, sym); } if (NIL_P(list) || !RB_TYPE_P(list, T_HASH)) { - list = rb_hash_new(); + list = ident_hash_new(); rb_hash_aset(hash, sym, list); } return list; |