[前][次][番号順一覧][スレッド一覧]

ruby-changes:46377

From: normal <ko1@a...>
Date: Thu, 27 Apr 2017 12:16:45 +0900 (JST)
Subject: [ruby-changes:46377] normal:r58491 (trunk): load.c: make fstrings from C strings sooner

normal	2017-04-27 12:16:39 +0900 (Thu, 27 Apr 2017)

  New Revision: 58491

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58491

  Log:
    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

  Modified files:
    trunk/load.c
Index: load.c
===================================================================
--- load.c	(revision 58490)
+++ load.c	(revision 58491)
@@ -571,7 +571,7 @@ rb_provide_feature(VALUE feature) https://github.com/ruby/ruby/blob/trunk/load.c#L571
 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) https://github.com/ruby/ruby/blob/trunk/load.c#L1058
 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());
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]