aboutsummaryrefslogtreecommitdiffstats
path: root/load.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-27 03:16:39 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-27 03:16:39 +0000
commit3cd04c26ae9cd06462515f79063059d6051e666d (patch)
tree5fbb2ab59efe4fc3708e2fe25b34062ade1c706d /load.c
parent10c87aa3b5b5a9df59a25f5273345dde57f1b707 (diff)
downloadruby-3cd04c26ae9cd06462515f79063059d6051e666d.tar.gz
load.c: make fstrings from C strings sooner
The underlying string objects will become fstrings anyways, so create the fstring directly from the C string to reduce intermediate garbage. * load.c (rb_provide, rb_provide): create fstring git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'load.c')
-rw-r--r--load.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/load.c b/load.c
index cba2763749..7d53b87eb3 100644
--- a/load.c
+++ b/load.c
@@ -571,7 +571,7 @@ rb_provide_feature(VALUE feature)
void
rb_provide(const char *feature)
{
- rb_provide_feature(rb_usascii_str_new2(feature));
+ rb_provide_feature(rb_fstring_cstr(feature));
}
NORETURN(static void load_failed(VALUE));
@@ -1058,8 +1058,7 @@ rb_require_safe(VALUE fname, int safe)
VALUE
rb_require(const char *fname)
{
- VALUE fn = rb_str_new2(fname);
- OBJ_FREEZE(fn);
+ VALUE fn = rb_str_new_cstr(fname);
return rb_require_safe(fn, rb_safe_level());
}