summaryrefslogtreecommitdiff
path: root/spec/ruby/optional/capi/ext/io_spec.c
diff options
context:
space:
mode:
authorNARUSE, Yui <[email protected]>2023-06-01 08:43:22 +0900
committerNARUSE, Yui <[email protected]>2023-06-01 08:43:22 +0900
commit85dcc4866d9ff29834596e9186cc97d622ee06f8 ()
treed5daa60146c5c8c2de9a9459a05e6e771d934362 /spec/ruby/optional/capi/ext/io_spec.c
parente4163112f6b99d9c205f6bc260878dcb00954a13 (diff)
Revert "Hide most of the implementation of `struct rb_io`. (#6511)"
This reverts commit 18e55fc1e1ec20e8f3166e3059e76c885fc9f8f2. fix [Bug #19704] https://bugs.ruby-lang.org/issues/19704 This breaks compatibility for extension libraries. Such changes need a discussion.
-rw-r--r--spec/ruby/optional/capi/ext/io_spec.c10
1 files changed, 1 insertions, 9 deletions
@@ -28,13 +28,9 @@ static int set_non_blocking(int fd) {
}
static int io_spec_get_fd(VALUE io) {
-#ifdef RUBY_VERSION_IS_3_1
- return rb_io_descriptor(io);
-#else
rb_io_t* fp;
GetOpenFile(io, fp);
return fp->fd;
-#endif
}
VALUE io_spec_GetOpenFile_fd(VALUE self, VALUE io) {
@@ -307,7 +303,7 @@ VALUE io_spec_rb_io_set_nonblock(VALUE self, VALUE io) {
GetOpenFile(io, fp);
rb_io_set_nonblock(fp);
#ifdef F_GETFL
- flags = fcntl(io_spec_get_fd(io), F_GETFL, 0);
return flags & O_NONBLOCK ? Qtrue : Qfalse;
#else
return Qfalse;
@@ -326,13 +322,9 @@ static VALUE io_spec_errno_set(VALUE self, VALUE val) {
}
VALUE io_spec_mode_sync_flag(VALUE self, VALUE io) {
-#ifdef RUBY_VERSION_IS_3_3
- if (rb_io_mode(io) & FMODE_SYNC) {
-#else
rb_io_t *fp;
GetOpenFile(io, fp);
if (fp->mode & FMODE_SYNC) {
-#endif
return Qtrue;
} else {
return Qfalse;