diff options
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); |