summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-03 23:55:06 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-03 23:55:06 +0000
commitb0cfa46bcea161a2907159c0cb228d869e4c1fa3 (patch)
tree93c5c135ea293699533bec3a881393f996b25fec /string.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 'string.c')
-rw-r--r--string.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/string.c b/string.c
index 3a7113dcc0..394fa8d332 100644
--- a/string.c
+++ b/string.c
@@ -10036,6 +10036,8 @@ Init_String(void)
#define rb_intern(str) rb_intern_const(str)
rb_cString = rb_define_class("String", rb_cObject);
+ assert(rb_vm_fstring_table());
+ st_foreach(rb_vm_fstring_table(), fstring_set_class_i, rb_cString);
rb_include_module(rb_cString, rb_mComparable);
rb_define_alloc_func(rb_cString, empty_str_alloc);
rb_define_singleton_method(rb_cString, "try_convert", rb_str_s_try_convert, 1);
@@ -10215,7 +10217,4 @@ Init_String(void)
rb_define_method(rb_cSymbol, "swapcase", sym_swapcase, -1);
rb_define_method(rb_cSymbol, "encoding", sym_encoding, 0);
-
- assert(rb_vm_fstring_table());
- st_foreach(rb_vm_fstring_table(), fstring_set_class_i, rb_cString);
}