diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-04 07:16:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-04 07:16:21 +0000 |
commit | 56ff2b50f314e8d38ef37cdb08356546c0631b05 (patch) | |
tree | 8734f7e5f7ade7c160a271cedccef3756d57258d /parse.y | |
parent | 72194a89dac3eb5dcfe47e23eebf61acdd77d056 (diff) | |
download | ruby-56ff2b50f314e8d38ef37cdb08356546c0631b05.tar.gz |
parse.y: use rb_fstring_new
* parse.y (rb_id2str): use rb_fstring_new() instead of rb_fstring()
with a new string instance.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -10144,6 +10144,8 @@ static const struct { }; #define op_tbl_count numberof(op_tbl) +STATIC_ASSERT(op_tbl_name_size, sizeof(op_tbl[0].name) == 3); +#define op_tbl_len(i) (!op_tbl[i].name[1] ? 1 : !op_tbl[i].name[2] ? 2 : 3) static struct symbols { ID last_id; @@ -10800,9 +10802,7 @@ rb_id2str(ID id) char name[2]; name[0] = (char)id; name[1] = 0; - str = rb_usascii_str_new(name, 1); - OBJ_FREEZE(str); - str = rb_fstring(str); + str = rb_fstring_new(name, 1); global_symbols.op_sym[i] = str; global_symbols.minor_marked = 0; } @@ -10812,9 +10812,8 @@ rb_id2str(ID id) if (op_tbl[i].token == id) { VALUE str = global_symbols.op_sym[i]; if (!str) { - str = rb_usascii_str_new2(op_tbl[i].name); - OBJ_FREEZE(str); - str = rb_fstring(str); + const char *name = op_tbl[i].name; + str = rb_fstring_new(name, op_tbl_len(i)); global_symbols.op_sym[i] = str; global_symbols.minor_marked = 0; } |