[ruby/stringio] Support for rb_io_mode_t

(https://github.com/ruby/stringio/pull/129)

Companion PR to <https://github.com/ruby/ruby/pull/7894>.

2d3988e12f
This commit is contained in:
Samuel Williams 2025-04-15 20:15:26 +09:00 committed by git
parent f6fddbd337
commit 28491e53cd
2 changed files with 9 additions and 2 deletions

View file

@ -35,12 +35,16 @@ STRINGIO_VERSION = "3.1.6";
# 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
struct StringIO {
VALUE string;
rb_encoding *enc;
long pos;
long lineno;
int flags;
rb_io_mode_t flags;
int count;
};
@ -1852,7 +1856,8 @@ strio_set_encoding(int argc, VALUE *argv, VALUE self)
enc = rb_find_encoding(ext_enc);
if (!enc) {
rb_io_enc_t convconfig;
int oflags, fmode;
int oflags;
rb_io_mode_t fmode;
VALUE vmode = rb_str_append(rb_str_new_cstr("r:"), ext_enc);
rb_io_extract_modeenc(&vmode, 0, Qnil, &oflags, &fmode, &convconfig);
enc = convconfig.enc2;