diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-06-05 17:06:46 +0900 |
---|---|---|
committer | git <[email protected]> | 2025-06-05 08:06:51 +0000 |
commit | 8906d55cb58e0e4db5d17d6de25376c67ddd530f () | |
tree | 67b8d883da5415b2ed9371dda3507b0e8e349e98 /ext | |
parent | 256440a82705ac53e5266b06428209ca375c72f8 (diff) |
[ruby/stringio] Extract internal part as the function
`str_chilled_p` (https://.com/ruby/stringio/pull/136) https://.com/ruby/stringio/commit/3c52ddc4c8
-rw-r--r-- | ext/stringio/stringio.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -36,6 +36,19 @@ STRINGIO_VERSION = "3.1.8.dev"; # define rb_class_new_instance_kw(argc, argv, klass, kw_splat) rb_class_new_instance(argc, argv, klass) #endif #ifndef HAVE_TYPE_RB_IO_MODE_T typedef int rb_io_mode_t; #endif @@ -1865,14 +1878,7 @@ strio_set_encoding(int argc, VALUE *argv, VALUE self) } } ptr->enc = enc; - if (!NIL_P(ptr->string) && WRITABLE(self) -#if (RUBY_API_VERSION_MAJOR == 3 && RUBY_API_VERSION_MINOR >= 4) || RUBY_API_VERSION_MAJOR >= 4 - // Do not attempt to modify chilled strings on Ruby 3.4+ - // RUBY_FL_USER2 == STR_CHILLED_LITERAL - // RUBY_FL_USER3 == STR_CHILLED_SYMBOL_TO_S - && !FL_TEST_RAW(ptr->string, RUBY_FL_USER2 | RUBY_FL_USER3) -#endif - ) { rb_enc_associate(ptr->string, enc); } |