[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>. https://github.com/ruby/stringio/commit/2d3988e12f
This commit is contained in:
parent
f6fddbd337
commit
28491e53cd
@ -1,6 +1,8 @@
|
|||||||
# frozen_string_literal: false
|
# frozen_string_literal: false
|
||||||
require 'mkmf'
|
require 'mkmf'
|
||||||
if RUBY_ENGINE == 'ruby'
|
if RUBY_ENGINE == 'ruby'
|
||||||
|
have_type("rb_io_mode_t", "ruby/io.h")
|
||||||
|
|
||||||
create_makefile('stringio')
|
create_makefile('stringio')
|
||||||
else
|
else
|
||||||
File.write('Makefile', dummy_makefile("").join)
|
File.write('Makefile', dummy_makefile("").join)
|
||||||
|
@ -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)
|
# define rb_class_new_instance_kw(argc, argv, klass, kw_splat) rb_class_new_instance(argc, argv, klass)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_TYPE_RB_IO_MODE_T
|
||||||
|
typedef int rb_io_mode_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct StringIO {
|
struct StringIO {
|
||||||
VALUE string;
|
VALUE string;
|
||||||
rb_encoding *enc;
|
rb_encoding *enc;
|
||||||
long pos;
|
long pos;
|
||||||
long lineno;
|
long lineno;
|
||||||
int flags;
|
rb_io_mode_t flags;
|
||||||
int count;
|
int count;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1852,7 +1856,8 @@ strio_set_encoding(int argc, VALUE *argv, VALUE self)
|
|||||||
enc = rb_find_encoding(ext_enc);
|
enc = rb_find_encoding(ext_enc);
|
||||||
if (!enc) {
|
if (!enc) {
|
||||||
rb_io_enc_t convconfig;
|
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);
|
VALUE vmode = rb_str_append(rb_str_new_cstr("r:"), ext_enc);
|
||||||
rb_io_extract_modeenc(&vmode, 0, Qnil, &oflags, &fmode, &convconfig);
|
rb_io_extract_modeenc(&vmode, 0, Qnil, &oflags, &fmode, &convconfig);
|
||||||
enc = convconfig.enc2;
|
enc = convconfig.enc2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user