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
This commit is contained in:
parent
d249b047c2
commit
42c2df9937
5
load.c
5
load.c
@ -571,7 +571,7 @@ rb_provide_feature(VALUE feature)
|
|||||||
void
|
void
|
||||||
rb_provide(const char *feature)
|
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));
|
NORETURN(static void load_failed(VALUE));
|
||||||
@ -1058,8 +1058,7 @@ rb_require_safe(VALUE fname, int safe)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_require(const char *fname)
|
rb_require(const char *fname)
|
||||||
{
|
{
|
||||||
VALUE fn = rb_str_new2(fname);
|
VALUE fn = rb_str_new_cstr(fname);
|
||||||
OBJ_FREEZE(fn);
|
|
||||||
return rb_require_safe(fn, rb_safe_level());
|
return rb_require_safe(fn, rb_safe_level());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user