From 6f484e4930be69c58462dd11c97663e6c8488b8e Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 3 Sep 2002 05:20:14 +0000 Subject: * variable.c (rb_copy_generic_ivar): remove old generic instance variable table if it existes. * class.c (rb_make_metaclass): metaclass of a metaclass is a metaclass itself. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- hash.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'hash.c') diff --git a/hash.c b/hash.c index 60dc89ff0b..3c0aeab2b8 100644 --- a/hash.c +++ b/hash.c @@ -254,30 +254,6 @@ to_hash(hash) return rb_convert_type(hash, T_HASH, "Hash", "to_hash"); } -static VALUE -rb_hash_become(copy, orig) - VALUE copy, orig; -{ - orig = to_hash(orig); - if (RHASH(copy)->tbl) st_free_table(RHASH(copy)->tbl); - RHASH(copy)->tbl = (st_table*)st_copy(RHASH(orig)->tbl); - RHASH(copy)->ifnone = RHASH(orig)->ifnone; - if (FL_TEST(orig, HASH_PROC_DEFAULT)) { - FL_SET(copy, HASH_PROC_DEFAULT); - } - else { - FL_UNSET(copy, HASH_PROC_DEFAULT); - } - if (FL_TEST(orig, HASH_DELETED)) { - FL_SET(copy, HASH_DELETED); - } - else { - FL_UNSET(copy, HASH_DELETED); - } - - return copy; -} - static int rb_hash_rehash_i(key, value, tbl) VALUE key, value; @@ -596,7 +572,7 @@ replace_i(key, val, hash) } static VALUE -rb_hash_replace(hash, hash2) +rb_hash_become(hash, hash2) VALUE hash, hash2; { hash2 = to_hash(hash2); @@ -1654,7 +1630,7 @@ Init_Hash() rb_define_method(rb_cHash,"clear", rb_hash_clear, 0); rb_define_method(rb_cHash,"invert", rb_hash_invert, 0); rb_define_method(rb_cHash,"update", rb_hash_update, 1); - rb_define_method(rb_cHash,"replace", rb_hash_replace, 1); + rb_define_method(rb_cHash,"replace", rb_hash_become, 1); rb_define_method(rb_cHash,"include?", rb_hash_has_key, 1); rb_define_method(rb_cHash,"member?", rb_hash_has_key, 1); -- cgit v1.2.3