summaryrefslogtreecommitdiff
path: root/ext/stringio/stringio.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-13 06:04:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-13 06:04:39 +0000
commitf75fe0bcc7d1143f33c91ab2096aafcf618394d2 (patch)
tree60422735fa52139bc59eff492dbe636ed3c76249 /ext/stringio/stringio.c
parent89bfc9b70b05ac598d24bb712222b79fb9af1880 (diff)
stringio.c: don't raise after close
* ext/stringio/stringio.c (strio_close): don't raise on dobule close for consistent to IO#close. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio/stringio.c')
-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;