summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/stringio/stringio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 78988e1..ed141dd 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -360,8 +360,8 @@ strio_close(VALUE self)
static VALUE
strio_close_read(VALUE self)
{
- StringIO(self);
- if (!READABLE(self)) {
+ struct StringIO *ptr = StringIO(self);
+ if (!(ptr->flags & FMODE_READABLE)) {
rb_raise(rb_eIOError, "closing non-duplex IO for reading");
}
RBASIC(self)->flags &= ~STRIO_READABLE;
@@ -378,8 +378,8 @@ strio_close_read(VALUE self)
static VALUE
strio_close_write(VALUE self)
{
- StringIO(self);
- if (!WRITABLE(self)) {
+ struct StringIO *ptr = StringIO(self);
+ if (!(ptr->flags & FMODE_WRITABLE)) {
rb_raise(rb_eIOError, "closing non-duplex IO for writing");
}
RBASIC(self)->flags &= ~STRIO_WRITABLE;