summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-17 00:55:45 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-17 00:55:45 +0000
commit05404cba6ef27ea76b30aa39d1c3b368c78c8e7d (patch)
treee8a9c655651d403740ee5a58364af7eb9ac07a92 /io.c
parentadce0ea944a9876107808fea5a5972089ae6d18b (diff)
deduplicate "/", ":" and "\n" strings
"/" and ":" are always statically registered in symbol.c (Init_op_tbl), and "\n" is a commonly seen in source code. * file.c (Init_File): fstring on File::SEPARATOR and File::PATH_SEPARATOR * io.c (Init_IO): fstring on rb_default_rs ("\n") git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/io.c b/io.c
index 3c2a0a46c4..29b3f525bb 100644
--- a/io.c
+++ b/io.c
@@ -12413,10 +12413,10 @@ Init_IO(void)
rb_output_fs = Qnil;
rb_define_hooked_variable("$,", &rb_output_fs, 0, rb_str_setter);
- rb_rs = rb_default_rs = rb_usascii_str_new2("\n");
+ rb_default_rs = rb_fstring_cstr("\n"); /* avoid modifying RS_default */
rb_gc_register_mark_object(rb_default_rs);
+ rb_rs = rb_default_rs;
rb_output_rs = Qnil;
- OBJ_FREEZE(rb_default_rs); /* avoid modifying RS_default */
rb_define_hooked_variable("$/", &rb_rs, 0, rb_str_setter);
rb_define_hooked_variable("$-0", &rb_rs, 0, rb_str_setter);
rb_define_hooked_variable("$\\", &rb_output_rs, 0, rb_str_setter);