summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-08 05:45:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-08 05:45:00 +0000
commit16b8aadc75a50f8c9472f049de4e68678380b823 (patch)
treefd981220e02bbf145371d756b5d29cd0e4d92383 /object.c
parent7c072b35d18391b9a1f848c6adc707c3ebbb1791 (diff)
object.c: no longer copy tables of classes/modules
* object.c (init_copy): no longer copy tables of classes/modules, since r45874 rb_mod_init_copy() does it instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/object.c b/object.c
index e5e0da4..6e0ca74 100644
--- a/object.c
+++ b/object.c
@@ -265,8 +265,7 @@ init_copy(VALUE dest, VALUE obj)
RBASIC(dest)->flags |= RBASIC(obj)->flags & (T_MASK|FL_EXIVAR|FL_TAINT);
rb_copy_generic_ivar(dest, obj);
rb_gc_copy_finalizer(dest, obj);
- switch (TYPE(obj)) {
- case T_OBJECT:
+ if (RB_TYPE_P(obj, T_OBJECT)) {
if (!(RBASIC(dest)->flags & ROBJECT_EMBED) && ROBJECT_IVPTR(dest)) {
xfree(ROBJECT_IVPTR(dest));
ROBJECT(dest)->as.heap.ivptr = 0;
@@ -286,21 +285,6 @@ init_copy(VALUE dest, VALUE obj)
ROBJECT(dest)->as.heap.iv_index_tbl = ROBJECT(obj)->as.heap.iv_index_tbl;
RBASIC(dest)->flags &= ~ROBJECT_EMBED;
}
- break;
- case T_CLASS:
- case T_MODULE:
- if (RCLASS_IV_TBL(dest)) {
- st_free_table(RCLASS_IV_TBL(dest));
- RCLASS_IV_TBL(dest) = 0;
- }
- if (RCLASS_CONST_TBL(dest)) {
- rb_free_const_table(RCLASS_CONST_TBL(dest));
- RCLASS_CONST_TBL(dest) = 0;
- }
- if (RCLASS_IV_TBL(obj)) {
- RCLASS_IV_TBL(dest) = rb_st_copy(dest, RCLASS_IV_TBL(obj));
- }
- break;
}
}