From 05404cba6ef27ea76b30aa39d1c3b368c78c8e7d Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 17 Mar 2017 00:55:45 +0000 Subject: 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 --- file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index 3f1212d91c..8bca84283d 100644 --- a/file.c +++ b/file.c @@ -6013,7 +6013,7 @@ Init_File(void) rb_define_singleton_method(rb_cFile, "extname", rb_file_s_extname, 1); rb_define_singleton_method(rb_cFile, "path", rb_file_s_path, 1); - separator = rb_obj_freeze(rb_usascii_str_new2("/")); + separator = rb_fstring_cstr("/"); /* separates directory parts in path */ rb_define_const(rb_cFile, "Separator", separator); rb_define_const(rb_cFile, "SEPARATOR", separator); @@ -6027,7 +6027,7 @@ Init_File(void) rb_define_const(rb_cFile, "ALT_SEPARATOR", Qnil); #endif /* path list separator */ - rb_define_const(rb_cFile, "PATH_SEPARATOR", rb_obj_freeze(rb_str_new2(PATH_SEP))); + rb_define_const(rb_cFile, "PATH_SEPARATOR", rb_fstring_cstr(PATH_SEP)); rb_define_method(rb_cIO, "stat", rb_io_stat, 0); /* this is IO's method */ rb_define_method(rb_cFile, "lstat", rb_file_lstat, 0); -- cgit v1.2.3