1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2003-03-28 10:33:43 +00:00
parent 15e11a88c6
commit 2cefaf671a
2 changed files with 18 additions and 1 deletions

View file

@ -1,3 +1,11 @@
Fri Mar 28 19:33:39 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* 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 <akr@m17n.org>
* regex.c (re_compile_pattern): fix [:name:] handling.

View file

@ -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;
}