summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-28 10:33:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-28 10:33:43 +0000
commit2cefaf671a0d32068ed6c2b35c28f377c4dd209f (patch)
treeab8eb48b41aeba58c590c2a8b55da7edee9d2e1e /variable.c
parent15e11a88c67334ea0ebae13cf59889f43d47ee6a (diff)
* variable.c (rb_class_path): hold temporary class path in a
instance variable to get rid of GC. [ruby-dev:19932] * variable.c (classname): remove temporary class path when exact name found. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/variable.c b/variable.c
index 9ac004e..0f5185a 100644
--- a/variable.c
+++ b/variable.c
@@ -156,9 +156,17 @@ classname(klass)
}
}
if (NIL_P(path)) {
+ ID tmppath = rb_intern("__tmp_classpath__");
+
path = find_class_path(klass);
if (NIL_P(path)) {
- return 0;
+ if (!RCLASS(klass)->iv_tbl ||
+ !st_lookup(RCLASS(klass)->iv_tbl, tmppath, &path)) {
+ return 0;
+ }
+ }
+ else if (RCLASS(klass)->iv_tbl) {
+ st_delete(RCLASS(klass)->iv_tbl, &tmppath, 0);
}
return path;
}
@@ -199,6 +207,7 @@ rb_class_path(klass)
str = rb_str_new(0, 2 + strlen(s) + 3 + 2 * SIZEOF_LONG + 1);
sprintf(RSTRING(str)->ptr, "#<%s:0x%lx>", s, klass);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
+ rb_iv_set(klass, "__tmp_classpath__", str);
return str;
}