summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-20 16:12:38 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-20 16:12:38 +0000
commit3531114afb6671fac16010b059cba09aba926da6 (patch)
treed76e05b00a114f244881253d39c766f437af6d31 /io.c
parent51405c8f7493a68992f5e858b55d3a922a24dbbf (diff)
downloadruby-3531114afb6671fac16010b059cba09aba926da6.tar.gz
ruby-3531114afb6671fac16010b059cba09aba926da6.tar.xz
ruby-3531114afb6671fac16010b059cba09aba926da6.zip
* io.c (select_internal): should return original value.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/io.c b/io.c
index d62270ed7..1a59cf200 100644
--- a/io.c
+++ b/io.c
@@ -5069,11 +5069,12 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
if (rp) {
list = RARRAY_PTR(res)[0];
for (i=0; i< RARRAY_LEN(read); i++) {
- VALUE io = rb_io_get_io(rb_ary_entry(read, i));
+ VALUE obj = rb_ary_entry(read, i);
+ VALUE io = rb_io_get_io(obj);
GetOpenFile(io, fptr);
if (rb_fd_isset(fptr->fd, &fds[0]) ||
rb_fd_isset(fptr->fd, &fds[3])) {
- rb_ary_push(list, io);
+ rb_ary_push(list, obj);
}
}
}
@@ -5081,11 +5082,12 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
if (wp) {
list = RARRAY_PTR(res)[1];
for (i=0; i< RARRAY_LEN(write); i++) {
- VALUE io = rb_io_get_io(rb_ary_entry(write, i));
+ VALUE obj = rb_ary_entry(write, i);
+ VALUE io = rb_io_get_io(obj);
VALUE write_io = GetWriteIO(io);
GetOpenFile(write_io, fptr);
if (rb_fd_isset(fptr->fd, &fds[1])) {
- rb_ary_push(list, io);
+ rb_ary_push(list, obj);
}
}
}
@@ -5093,16 +5095,17 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
if (ep) {
list = RARRAY_PTR(res)[2];
for (i=0; i< RARRAY_LEN(except); i++) {
- VALUE io = rb_io_get_io(rb_ary_entry(write, i));
+ VALUE obj = rb_ary_entry(write, i);
+ VALUE io = rb_io_get_io(obj);
VALUE write_io = GetWriteIO(io);
GetOpenFile(io, fptr);
if (rb_fd_isset(fptr->fd, &fds[2])) {
- rb_ary_push(list, io);
+ rb_ary_push(list, obj);
}
else if (io != write_io) {
GetOpenFile(write_io, fptr);
if (rb_fd_isset(fptr->fd, &fds[2])) {
- rb_ary_push(list, io);
+ rb_ary_push(list, obj);
}
}
}