mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
[EXPERIMENTAL] Make Module#name return a frozen String
* Always the same frozen String for a given Module or Class. * Avoids extra allocations whenever calling Module#name. * See [Feature #16150]
This commit is contained in:
parent
c8f7168653
commit
9d0866c7d7
Notes:
git
2019-09-26 20:25:58 +09:00
3 changed files with 24 additions and 9 deletions
|
@ -107,10 +107,7 @@ VALUE
|
|||
rb_mod_name(VALUE mod)
|
||||
{
|
||||
int permanent;
|
||||
VALUE path = classname(mod, &permanent);
|
||||
|
||||
if (!NIL_P(path)) return rb_str_dup(path);
|
||||
return path;
|
||||
return classname(mod, &permanent);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue