[ruby/stringio] Avoid direct struct usage.
(https://github.com/ruby/stringio/pull/54) We will eventually want to refactor this, but for now this is compatible enough.
This commit is contained in:
parent
957b6a491f
commit
d5a5333168
@ -276,7 +276,7 @@ strio_init(int argc, VALUE *argv, struct StringIO *ptr, VALUE self)
|
|||||||
{
|
{
|
||||||
VALUE string, vmode, opt;
|
VALUE string, vmode, opt;
|
||||||
int oflags;
|
int oflags;
|
||||||
struct rb_io_enc_t convconfig;
|
rb_io_enc_t convconfig;
|
||||||
|
|
||||||
argc = rb_scan_args(argc, argv, "02:", &string, &vmode, &opt);
|
argc = rb_scan_args(argc, argv, "02:", &string, &vmode, &opt);
|
||||||
rb_io_extract_modeenc(&vmode, 0, opt, &oflags, &ptr->flags, &convconfig);
|
rb_io_extract_modeenc(&vmode, 0, opt, &oflags, &ptr->flags, &convconfig);
|
||||||
@ -1743,7 +1743,7 @@ strio_set_encoding(int argc, VALUE *argv, VALUE self)
|
|||||||
else {
|
else {
|
||||||
enc = rb_find_encoding(ext_enc);
|
enc = rb_find_encoding(ext_enc);
|
||||||
if (!enc) {
|
if (!enc) {
|
||||||
struct rb_io_enc_t convconfig;
|
rb_io_enc_t convconfig;
|
||||||
int oflags, fmode;
|
int oflags, 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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user