mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
9109292789
commit
6def265d79
1 changed files with 2 additions and 3 deletions
|
@ -49,7 +49,7 @@ fc_path(struct fc_result *fc, ID name)
|
|||
{
|
||||
VALUE path, tmp;
|
||||
|
||||
path = rb_str_dup(rb_id2str(name));
|
||||
path = rb_id2str(name);
|
||||
while (fc) {
|
||||
st_data_t n;
|
||||
if (fc->track == rb_cObject) break;
|
||||
|
@ -176,8 +176,7 @@ classname(VALUE klass, int *permanent)
|
|||
return Qnil;
|
||||
}
|
||||
if (!st_lookup(RCLASS_IV_TBL(klass), (st_data_t)tmp_classpath, &n)) {
|
||||
path = rb_str_dup(rb_id2str(cid));
|
||||
OBJ_FREEZE(path);
|
||||
path = rb_id2str(cid);
|
||||
return path;
|
||||
}
|
||||
*permanent = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue