summaryrefslogtreecommitdiff
path: root/symbol.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-03 23:55:06 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-03 23:55:06 (GMT)
commitb0cfa46bcea161a2907159c0cb228d869e4c1fa3 (patch)
tree93c5c135ea293699533bec3a881393f996b25fec /symbol.c
parent257bf9c0d07772b201b592eb5e19df80cd459957 (diff)
symbol.c (rb_id2str): eliminate branch to set class
Since the fstring table encompasses all strings in the symbol table, we may reuse the fstring table walk to set the class and eliminate the branch in rb_id2str. * string.c (Init_String): use rb_cString immediately after definition * symbol.c (rb_id2str): eliminate branch to set class git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'symbol.c')
-rw-r--r--symbol.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/symbol.c b/symbol.c
index facdb3c..f4516eb 100644
--- a/symbol.c
+++ b/symbol.c
@@ -744,15 +744,7 @@ rb_sym2str(VALUE sym)
VALUE
rb_id2str(ID id)
{
- VALUE str;
-
- if ((str = lookup_id_str(id)) != 0) {
- if (RBASIC(str)->klass == 0)
- RBASIC_SET_CLASS_RAW(str, rb_cString);
- return str;
- }
-
- return 0;
+ return lookup_id_str(id);
}
const char *