diff --git a/ChangeLog b/ChangeLog index c882a94c34..40bcef4a86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Mar 28 19:33:39 2003 Nobuyoshi Nakada + + * 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. + Thu Mar 27 12:10:15 2003 Tanaka Akira * regex.c (re_compile_pattern): fix [:name:] handling. diff --git a/variable.c b/variable.c index 9ac004e7f5..0f5185a5fa 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; }