mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
freeze Encoding objects
Encoding objects can be accessed in multi-ractors and there is no state to mutate. So we can mark it as frozen and shareable. [Bug #17188]
This commit is contained in:
parent
11c2f0f36c
commit
102c2ba65f
Notes:
git
2020-10-14 14:02:33 +09:00
1 changed files with 4 additions and 1 deletions
|
@ -122,7 +122,10 @@ rb_data_is_encoding(VALUE obj)
|
|||
static VALUE
|
||||
enc_new(rb_encoding *encoding)
|
||||
{
|
||||
return TypedData_Wrap_Struct(rb_cEncoding, &encoding_data_type, (void *)encoding);
|
||||
VALUE enc = TypedData_Wrap_Struct(rb_cEncoding, &encoding_data_type, (void *)encoding);
|
||||
rb_obj_freeze(enc);
|
||||
FL_SET_RAW(enc, RUBY_FL_SHAREABLE);
|
||||
return enc;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue