diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-03 05:20:14 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-03 05:20:14 +0000 |
commit | 6f484e4930be69c58462dd11c97663e6c8488b8e (patch) | |
tree | 324b1dbdf4149be943eb3cbff26ad7f377e53dc0 /hash.c | |
parent | 20254d4e133331e69e6aa7514e1e72ad7d14d496 (diff) | |
download | ruby-6f484e4930be69c58462dd11c97663e6c8488b8e.tar.gz |
* 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
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 28 |
1 files changed, 2 insertions, 26 deletions
@@ -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); |