Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This is a file used by GitHub to ignore the following commits on `git blame`.
#
# You can also do the same thing in your local repository with:
# $ git config --local blame.ignoreRevsFile .git-blame-ignore-revs

# Expand tabs
e8ab2ab28a1481cc10b06e9a9add302b1ef0dbf7
46 changes: 23 additions & 23 deletions ext/io/wait/wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ get_timeout(int argc, VALUE *argv, struct timeval *timerec)
VALUE timeout = Qnil;
rb_check_arity(argc, 0, 1);
if (!argc || NIL_P(timeout = argv[0])) {
return NULL;
return NULL;
}
else {
*timerec = rb_time_interval(timeout);
return timerec;
*timerec = rb_time_interval(timeout);
return timerec;
}
}

Expand All @@ -60,7 +60,7 @@ wait_for_single_fd(rb_io_t *fptr, int events, struct timeval *tv)
{
int i = rb_wait_for_single_fd(fptr->fd, events, tv);
if (i < 0)
rb_sys_fail(0);
rb_sys_fail(0);
rb_io_check_closed(fptr);
return (i & events);
}
Expand Down Expand Up @@ -180,7 +180,7 @@ io_wait_readable(int argc, VALUE *argv, VALUE io)

#ifndef HAVE_RB_IO_WAIT
if (wait_for_single_fd(fptr, RB_WAITFD_IN, tv)) {
return io;
return io;
}
return Qnil;
#else
Expand Down Expand Up @@ -216,7 +216,7 @@ io_wait_writable(int argc, VALUE *argv, VALUE io)
#ifndef HAVE_RB_IO_WAIT
tv = get_timeout(argc, argv, &timerec);
if (wait_for_single_fd(fptr, RB_WAITFD_OUT, tv)) {
return io;
return io;
}
return Qnil;
#else
Expand Down Expand Up @@ -260,31 +260,31 @@ static int
wait_mode_sym(VALUE mode)
{
if (mode == ID2SYM(rb_intern("r"))) {
return RB_WAITFD_IN;
return RB_WAITFD_IN;
}
if (mode == ID2SYM(rb_intern("read"))) {
return RB_WAITFD_IN;
return RB_WAITFD_IN;
}
if (mode == ID2SYM(rb_intern("readable"))) {
return RB_WAITFD_IN;
return RB_WAITFD_IN;
}
if (mode == ID2SYM(rb_intern("w"))) {
return RB_WAITFD_OUT;
return RB_WAITFD_OUT;
}
if (mode == ID2SYM(rb_intern("write"))) {
return RB_WAITFD_OUT;
return RB_WAITFD_OUT;
}
if (mode == ID2SYM(rb_intern("writable"))) {
return RB_WAITFD_OUT;
return RB_WAITFD_OUT;
}
if (mode == ID2SYM(rb_intern("rw"))) {
return RB_WAITFD_IN|RB_WAITFD_OUT;
return RB_WAITFD_IN|RB_WAITFD_OUT;
}
if (mode == ID2SYM(rb_intern("read_write"))) {
return RB_WAITFD_IN|RB_WAITFD_OUT;
return RB_WAITFD_IN|RB_WAITFD_OUT;
}
if (mode == ID2SYM(rb_intern("readable_writable"))) {
return RB_WAITFD_IN|RB_WAITFD_OUT;
return RB_WAITFD_IN|RB_WAITFD_OUT;
}
rb_raise(rb_eArgError, "unsupported mode: %"PRIsVALUE, mode);
return 0;
Expand Down Expand Up @@ -333,20 +333,20 @@ io_wait(int argc, VALUE *argv, VALUE io)

GetOpenFile(io, fptr);
for (i = 0; i < argc; ++i) {
if (SYMBOL_P(argv[i])) {
event |= wait_mode_sym(argv[i]);
}
else {
*(tv = &timerec) = rb_time_interval(argv[i]);
}
if (SYMBOL_P(argv[i])) {
event |= wait_mode_sym(argv[i]);
}
else {
*(tv = &timerec) = rb_time_interval(argv[i]);
}
}
/* rb_time_interval() and might_mode() might convert the argument */
rb_io_check_closed(fptr);
if (!event) event = RB_WAITFD_IN;
if ((event & RB_WAITFD_IN) && rb_io_read_pending(fptr))
return Qtrue;
return Qtrue;
if (wait_for_single_fd(fptr, event, tv))
return io;
return io;
return Qnil;
#else
VALUE timeout = Qundef;
Expand Down