summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-28 08:44:37 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-28 08:44:37 +0000
commit19ee1d0e5596c710e3d0b14dfd9a9faacd19e907 (patch)
treee3000c000b5de19ae8379f6708455dd0f0a9e06b /class.c
parent81e56b52f890e8bdcd4077879c94e5389d4ad595 (diff)
* object.c (rb_str2cstr): warn if string contains \0 and length
value is ignored. * class.c (rb_singleton_class_clone): should copy class constant table as well. * class.c (rb_include_module): sometimes cache was mistakenly left uncleared - based on the patch by K.Kosako. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/class.c b/class.c
index 2eedb262dc..b5a9a21e42 100644
--- a/class.c
+++ b/class.c
@@ -67,6 +67,9 @@ rb_singleton_class_clone(klass)
clone->super = RCLASS(klass)->super;
clone->iv_tbl = 0;
clone->m_tbl = 0;
+ if (RCLASS(klass)->iv_tbl) {
+ clone->iv_tbl = st_copy(RCLASS(klass)->iv_tbl);
+ }
clone->m_tbl = st_init_numtable();
st_foreach(RCLASS(klass)->m_tbl, clone_method, clone->m_tbl);
FL_SET(clone, FL_SINGLETON);
@@ -217,6 +220,7 @@ rb_include_module(klass, module)
VALUE klass, module;
{
VALUE p;
+ int changed = 0;
if (NIL_P(module)) return;
if (klass == module) return;
@@ -238,16 +242,17 @@ rb_include_module(klass, module)
if (RCLASS(module)->super) {
rb_include_module(p, RCLASS(module)->super);
}
+ if (changed) rb_clear_cache();
return;
}
}
rb_frozen_class_p(klass);
- RCLASS(klass)->super =
- include_class_new(module, RCLASS(klass)->super);
+ RCLASS(klass)->super = include_class_new(module, RCLASS(klass)->super);
klass = RCLASS(klass)->super;
module = RCLASS(module)->super;
+ changed = 1;
}
- rb_clear_cache();
+ if (changed) rb_clear_cache();
}
VALUE