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

ruby-changes:40780

From: nobu <ko1@a...>
Date: Wed, 2 Dec 2015 17:01:08 +0900 (JST)
Subject: [ruby-changes:40780] nobu:r52859 (trunk): encoding.c: make fstring

nobu	2015-12-02 17:00:56 +0900 (Wed, 02 Dec 2015)

  New Revision: 52859

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

  Log:
    encoding.c: make fstring
    
    * encoding.c (enc_name, rb_enc_name_list_i, rb_enc_aliases_enc_i):
      make fstring instead of making each copies.

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c
Index: encoding.c
===================================================================
--- encoding.c	(revision 52858)
+++ encoding.c	(revision 52859)
@@ -1134,7 +1134,7 @@ enc_inspect(VALUE self) https://github.com/ruby/ruby/blob/trunk/encoding.c#L1134
 static VALUE
 enc_name(VALUE self)
 {
-    return rb_usascii_str_new2(rb_enc_name((rb_encoding*)DATA_PTR(self)));
+    return rb_fstring_cstr(rb_enc_name((rb_encoding*)DATA_PTR(self)));
 }
 
 static int
@@ -1633,8 +1633,7 @@ static int https://github.com/ruby/ruby/blob/trunk/encoding.c#L1633
 rb_enc_name_list_i(st_data_t name, st_data_t idx, st_data_t arg)
 {
     VALUE ary = (VALUE)arg;
-    VALUE str = rb_usascii_str_new2((char *)name);
-    OBJ_FREEZE(str);
+    VALUE str = rb_fstring_cstr((char *)name);
     rb_ary_push(ary, str);
     return ST_CONTINUE;
 }
@@ -1676,8 +1675,7 @@ rb_enc_aliases_enc_i(st_data_t name, st_ https://github.com/ruby/ruby/blob/trunk/encoding.c#L1675
 	if (STRCASECMP((char*)name, rb_enc_name(enc)) == 0) {
 	    return ST_CONTINUE;
 	}
-	str = rb_usascii_str_new2(rb_enc_name(enc));
-	OBJ_FREEZE(str);
+	str = rb_fstring_cstr(rb_enc_name(enc));
 	rb_ary_store(ary, idx, str);
     }
     key = rb_usascii_str_new2((char *)name);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52858)
+++ ChangeLog	(revision 52859)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Dec  2 17:00:54 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* encoding.c (enc_name, rb_enc_name_list_i, rb_enc_aliases_enc_i):
+	  make fstring instead of making each copies.
+
 Wed Dec  2 16:32:08 2015  Koichi Sasada  <ko1@a...>
 
 	* iseq.h: introduce ISEQ_COMPILE_DATA() macro.

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

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