Skip to content

Commit 42c2df9

Browse files
author
normal
committed
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
1 parent d249b04 commit 42c2df9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

load.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ rb_provide_feature(VALUE feature)
571571
void
572572
rb_provide(const char *feature)
573573
{
574-
rb_provide_feature(rb_usascii_str_new2(feature));
574+
rb_provide_feature(rb_fstring_cstr(feature));
575575
}
576576

577577
NORETURN(static void load_failed(VALUE));
@@ -1058,8 +1058,7 @@ rb_require_safe(VALUE fname, int safe)
10581058
VALUE
10591059
rb_require(const char *fname)
10601060
{
1061-
VALUE fn = rb_str_new2(fname);
1062-
OBJ_FREEZE(fn);
1061+
VALUE fn = rb_str_new_cstr(fname);
10631062
return rb_require_safe(fn, rb_safe_level());
10641063
}
10651064

0 commit comments

Comments
 (0)