summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-18 08:40:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-18 08:40:33 +0000
commit74097260aeac51cb2839d90f5cf7eb4c84c9124f (patch)
tree4b2f781b6af183d2eb4bab2fce876d6addc021d3 /variable.c
parentb49f3b26e5d96c22f3ccb578a5bef3dbff8f7dba (diff)
* eval.c (rb_thread_schedule): should not select a thread which is
not yet initialized. * variable.c (find_class_path): should initialize iv_tbl if it's NULL. * class.c (rb_define_class): should return the existing class if the class is already defined and its superclass is ideintical to the specified superclass. * class.c (rb_define_class_under): ditto. * class.c (rb_define_module): should return the existing module if the module is already defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/variable.c b/variable.c
index e2d9451182..f579a677e8 100644
--- a/variable.c
+++ b/variable.c
@@ -129,6 +129,9 @@ find_class_path(klass)
st_foreach(rb_class_tbl, fc_i, &arg);
}
if (arg.path) {
+ if (!ROBJECT(klass)->iv_tbl) {
+ ROBJECT(klass)->iv_tbl = st_init_numtable();
+ }
st_insert(ROBJECT(klass)->iv_tbl,rb_intern("__classpath__"),arg.path);
return arg.path;
}
@@ -142,12 +145,7 @@ classname(klass)
VALUE path = Qnil;
ID classpath = rb_intern("__classpath__");
- if (TYPE(klass) == T_ICLASS) {
- klass = RBASIC(klass)->klass;
- }
- while (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) {
- klass = (VALUE)RCLASS(klass)->super;
- }
+ klass = rb_class_real(klass);
if (!klass) klass = rb_cObject;
if (ROBJECT(klass)->iv_tbl &&
!st_lookup(ROBJECT(klass)->iv_tbl, classpath, &path)) {