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

ruby-changes:2357

From: ko1@a...
Date: 9 Nov 2007 13:37:53 +0900
Subject: [ruby-changes:2357] matz - Ruby:r13848 (trunk): * test/ruby/test_basicinstructions.rb: updated for new class

matz	2007-11-09 13:37:36 +0900 (Fri, 09 Nov 2007)

  New Revision: 13848

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c
    trunk/marshal.c
    trunk/test/ruby/test_basicinstructions.rb

  Log:
    * test/ruby/test_basicinstructions.rb: updated for new class
      behavior.  [ruby-dev:32192]
    
    * encoding.c (enc_name): Encoding should not rely on ENCODING in
      the FL_USERS flags.
    
    * encoding.c (rb_enc_from_encoding): do not call rb_enc_associate
      for encoding itself.
    
    * encoding.c (enc_register_at): ditto.
    
    * marshal.c (r_ivar): do not set real instance variable for
      encoding data associated.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13848&r2=13847
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_basicinstructions.rb?r1=13848&r2=13847
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/marshal.c?r1=13848&r2=13847
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/encoding.c?r1=13848&r2=13847

Index: encoding.c
===================================================================
--- encoding.c	(revision 13847)
+++ encoding.c	(revision 13848)
@@ -52,9 +52,7 @@
     if (!encoding) return 0;
     if (enc_initialized_p(encoding))
 	return ENC_FROM_ENCODING(encoding);
-    enc = enc_new(encoding);
-    rb_enc_associate(enc, encoding);
-    return enc;
+    return enc_new(encoding);
 }
 
 static int
@@ -146,8 +144,8 @@
     encoding = ent->enc;
     encoding->name = name;
     if (rb_cEncoding) {
-	VALUE enc = enc_new(encoding);
-	rb_enc_associate_index(enc, index);
+	/* initialize encoding data */
+	enc_new(encoding);
     }
     else {
 	encoding->auxiliary_data = ENC_UNINITIALIZED;
@@ -523,13 +521,13 @@
 enc_to_s(VALUE self)
 {
     return rb_sprintf("<%s:%s>", rb_obj_classname(self),
-		      rb_enc_name(enc_get_encoding(self)));
+		      rb_enc_name((rb_encoding*)DATA_PTR(self)));
 }
 
 static VALUE
 enc_name(VALUE self)
 {
-    return rb_str_new2(rb_enc_name(enc_get_encoding(self)));
+    return rb_str_new2(rb_enc_name((rb_encoding*)DATA_PTR(self)));
 }
 
 static VALUE
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13847)
+++ ChangeLog	(revision 13848)
@@ -2,6 +2,22 @@
 
 	* eval_load.c (loaded_feature_path): check with type of given feature.
 
+Fri Nov  9 12:43:02 2007  Yukihiro Matsumoto  <matz@r...>
+
+	* test/ruby/test_basicinstructions.rb: updated for new class
+	  behavior.  [ruby-dev:32192]
+
+	* encoding.c (enc_name): Encoding should not rely on ENCODING in
+	  the FL_USERS flags.
+
+	* encoding.c (rb_enc_from_encoding): do not call rb_enc_associate
+	  for encoding itself.
+
+	* encoding.c (enc_register_at): ditto.
+
+	* marshal.c (r_ivar): do not set real instance variable for
+	  encoding data associated.
+
 Fri Nov  9 10:43:55 2007  Nobuyoshi Nakada  <nobu@r...>
 
 	* eval.c (send_internal): use self in the previous frame to check for
Index: marshal.c
===================================================================
--- marshal.c	(revision 13847)
+++ marshal.c	(revision 13848)
@@ -1086,7 +1086,9 @@
 		int idx = rb_enc_find_index(StringValueCStr(val));
 		if (idx > 0) rb_enc_associate_index(obj, idx);
 	    }
-	    rb_ivar_set(obj, id, val);
+	    else {
+		rb_ivar_set(obj, id, val);
+	    }
 	}
     }
 }
Index: test/ruby/test_basicinstructions.rb
===================================================================
--- test/ruby/test_basicinstructions.rb	(revision 13847)
+++ test/ruby/test_basicinstructions.rb	(revision 13848)
@@ -483,16 +483,16 @@
     assert_equal 'B/singleton', CVarB.cvB
     assert_equal 'B/singleton', CVarB.cvB2
     assert_equal 'B/singleton', CVarB.new.cvB
-    assert_equal 'CVarA@@cv',   CVarA.cv
-    assert_equal 'CVarA@@cv',   CVarA.cv2
-    assert_equal 'CVarA@@cv',   CVarA.new.cv
+    assert_equal 'B/singleton', CVarA.cv
+    assert_equal 'B/singleton', CVarA.cv2
+    assert_equal 'B/singleton', CVarA.new.cv
     CVarB.new.cvB = 'B/instance'
     assert_equal 'B/instance',  CVarB.cvB
     assert_equal 'B/instance',  CVarB.cvB2
     assert_equal 'B/instance',  CVarB.new.cvB
-    assert_equal 'CVarA@@cv',   CVarA.cv
-    assert_equal 'CVarA@@cv',   CVarA.cv2
-    assert_equal 'CVarA@@cv',   CVarA.new.cv
+    assert_equal 'B/instance',  CVarA.cv
+    assert_equal 'B/instance',  CVarA.cv2
+    assert_equal 'B/instance',  CVarA.new.cv
 
     CVarA.cv = 'CVarA@@cv'
     CVarB.cvB = 'CVarB@@cv'

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

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