mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7afefea564
commit
e86f66b33f
2 changed files with 8 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Dec 2 17:00:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@atdot.net>
|
||||
|
||||
* iseq.h: introduce ISEQ_COMPILE_DATA() macro.
|
||||
|
|
|
@ -1134,7 +1134,7 @@ enc_inspect(VALUE self)
|
|||
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
|
|||
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_data_t orig, st_data_t arg)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue