1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

symbol.c: dsymbol initial encoding

* symbol.c (dsymbol_alloc): set encoding directly.  no need to
  check existing encoding in rb_enc_associate.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-06-28 07:34:36 +00:00
parent c6d5b61745
commit 40efaab301

View file

@ -509,7 +509,7 @@ dsymbol_alloc(const VALUE klass, const VALUE str, rb_encoding * const enc, const
const VALUE dsym = rb_newobj_of(klass, T_SYMBOL | FL_WB_PROTECTED);
long hashval;
rb_enc_associate(dsym, enc);
rb_enc_set_index(dsym, rb_enc_to_index(enc));
OBJ_FREEZE(dsym);
RB_OBJ_WRITE(dsym, &RSYMBOL(dsym)->fstr, str);
RSYMBOL(dsym)->id = type;