summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-03 05:20:14 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-03 05:20:14 +0000
commit6f484e4930be69c58462dd11c97663e6c8488b8e (patch)
tree324b1dbdf4149be943eb3cbff26ad7f377e53dc0 /variable.c
parent20254d4e133331e69e6aa7514e1e72ad7d14d496 (diff)
* 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 'variable.c')
-rw-r--r--variable.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/variable.c b/variable.c
index 0b2c8ebe07..c37548fb91 100644
--- a/variable.c
+++ b/variable.c
@@ -924,7 +924,15 @@ rb_copy_generic_ivar(clone, obj)
if (!generic_iv_tbl) return;
if (st_lookup(generic_iv_tbl, obj, &tbl)) {
- st_add_direct(generic_iv_tbl, clone, st_copy(tbl));
+ st_table *old;
+
+ if (st_lookup(generic_iv_tbl, clone, &old)) {
+ st_free_table(old);
+ st_insert(generic_iv_tbl, clone, st_copy(tbl));
+ }
+ else {
+ st_add_direct(generic_iv_tbl, clone, st_copy(tbl));
+ }
}
}