variable.c: frozen class name

* variable.c (fc_path, classname): return ID strings without
  unnecessary copying.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-12-08 11:38:34 +00:00
parent 9109292789
commit 6def265d79

View File

@ -49,7 +49,7 @@ fc_path(struct fc_result *fc, ID name)
{ {
VALUE path, tmp; VALUE path, tmp;
path = rb_str_dup(rb_id2str(name)); path = rb_id2str(name);
while (fc) { while (fc) {
st_data_t n; st_data_t n;
if (fc->track == rb_cObject) break; if (fc->track == rb_cObject) break;
@ -176,8 +176,7 @@ classname(VALUE klass, int *permanent)
return Qnil; return Qnil;
} }
if (!st_lookup(RCLASS_IV_TBL(klass), (st_data_t)tmp_classpath, &n)) { if (!st_lookup(RCLASS_IV_TBL(klass), (st_data_t)tmp_classpath, &n)) {
path = rb_str_dup(rb_id2str(cid)); path = rb_id2str(cid);
OBJ_FREEZE(path);
return path; return path;
} }
*permanent = 0; *permanent = 0;