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

use predefined IDs

* array.c (rb_ary_equal), hash.c (hash_equal): use predefined IDs,
  `to_ary` and `to_hash` respectively.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-05-20 08:28:31 +00:00
parent e3c3d4e4e5
commit 7f3b12f05b
2 changed files with 2 additions and 2 deletions

View file

@ -3759,7 +3759,7 @@ rb_ary_equal(VALUE ary1, VALUE ary2)
{ {
if (ary1 == ary2) return Qtrue; if (ary1 == ary2) return Qtrue;
if (!RB_TYPE_P(ary2, T_ARRAY)) { if (!RB_TYPE_P(ary2, T_ARRAY)) {
if (!rb_respond_to(ary2, rb_intern("to_ary"))) { if (!rb_respond_to(ary2, idTo_ary)) {
return Qfalse; return Qfalse;
} }
return rb_equal(ary2, ary1); return rb_equal(ary2, ary1);

2
hash.c
View file

@ -1930,7 +1930,7 @@ hash_equal(VALUE hash1, VALUE hash2, int eql)
if (hash1 == hash2) return Qtrue; if (hash1 == hash2) return Qtrue;
if (!RB_TYPE_P(hash2, T_HASH)) { if (!RB_TYPE_P(hash2, T_HASH)) {
if (!rb_respond_to(hash2, rb_intern("to_hash"))) { if (!rb_respond_to(hash2, idTo_hash)) {
return Qfalse; return Qfalse;
} }
if (eql) if (eql)