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

ruby-changes:33948

From: nobu <ko1@a...>
Date: Tue, 20 May 2014 17:28:39 +0900 (JST)
Subject: [ruby-changes:33948] nobu:r46029 (trunk): use predefined IDs

nobu	2014-05-20 17:28:31 +0900 (Tue, 20 May 2014)

  New Revision: 46029

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

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

  Modified files:
    trunk/array.c
    trunk/hash.c
Index: array.c
===================================================================
--- array.c	(revision 46028)
+++ array.c	(revision 46029)
@@ -3759,7 +3759,7 @@ rb_ary_equal(VALUE ary1, VALUE ary2) https://github.com/ruby/ruby/blob/trunk/array.c#L3759
 {
     if (ary1 == ary2) return Qtrue;
     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 rb_equal(ary2, ary1);
Index: hash.c
===================================================================
--- hash.c	(revision 46028)
+++ hash.c	(revision 46029)
@@ -1930,7 +1930,7 @@ hash_equal(VALUE hash1, VALUE hash2, int https://github.com/ruby/ruby/blob/trunk/hash.c#L1930
 
     if (hash1 == hash2) return Qtrue;
     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;
 	}
 	if (eql)

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

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