diff options
author | Jean Boussier <[email protected]> | 2019-09-26 10:41:43 +0200 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2019-09-26 13:25:23 +0200 |
commit | 9d0866c7d7b9cbe36a851744a37806e747e0e7a8 (patch) | |
tree | 0a5feb4dc71cf8fd4604c4e524a7ee2c360b3138 /variable.c | |
parent | c8f71686533cf068ad2f7a2e9fbb95a5c9f44642 (diff) |
[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]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2487
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/variable.c b/variable.c index 9fd075c21c..aafb6f4725 100644 --- a/variable.c +++ b/variable.c @@ -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 |