From 4ab384be2d4a98868c8da9739609585efc15f920 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 9 Nov 2007 04:37:36 +0000 Subject: * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- encoding.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'encoding.c') diff --git a/encoding.c b/encoding.c index 97e6cfff50..15a2398f05 100644 --- a/encoding.c +++ b/encoding.c @@ -52,9 +52,7 @@ rb_enc_from_encoding(rb_encoding *encoding) 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 @@ enc_register_at(int index, const char *name, rb_encoding *encoding) 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 @@ static VALUE 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 -- cgit v1.2.3