Skip to content

Commit

Permalink
* expand tabs. [ci skip]
Browse files Browse the repository at this point in the history
Tabs were expanded because the file did not have any tab indentation in unedited lines.
Please update your editor config, and use misc/expand_tabs.rb in the pre-commit hook.
  • Loading branch information
matzbot committed Jul 30, 2022
1 parent c258fb2 commit 0d842fe
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions ext/io/nonblock/nonblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ rb_io_nonblock_p(VALUE io)
rb_io_t *fptr;
GetOpenFile(io, fptr);
if (get_fcntl_flags(fptr->fd) & O_NONBLOCK)
return Qtrue;
return Qtrue;
return Qfalse;
}
#else
Expand All @@ -54,21 +54,21 @@ static void
set_fcntl_flags(int fd, int f)
{
if (fcntl(fd, F_SETFL, f) == -1)
rb_sys_fail(0);
rb_sys_fail(0);
}

static int
io_nonblock_set(int fd, int f, int nb)
{
if (nb) {
if ((f & O_NONBLOCK) != 0)
return 0;
f |= O_NONBLOCK;
if ((f & O_NONBLOCK) != 0)
return 0;
f |= O_NONBLOCK;
}
else {
if ((f & O_NONBLOCK) == 0)
return 0;
f &= ~O_NONBLOCK;
if ((f & O_NONBLOCK) == 0)
return 0;
f &= ~O_NONBLOCK;
}
set_fcntl_flags(fd, f);
return 1;
Expand Down Expand Up @@ -127,9 +127,9 @@ rb_io_nonblock_set(VALUE io, VALUE nb)
rb_io_t *fptr;
GetOpenFile(io, fptr);
if (RTEST(nb))
rb_io_set_nonblock(fptr);
rb_io_set_nonblock(fptr);
else
io_nonblock_set(fptr->fd, get_fcntl_flags(fptr->fd), RTEST(nb));
io_nonblock_set(fptr->fd, get_fcntl_flags(fptr->fd), RTEST(nb));
return io;
}

Expand Down Expand Up @@ -160,15 +160,15 @@ rb_io_nonblock_block(int argc, VALUE *argv, VALUE io)

GetOpenFile(io, fptr);
if (argc > 0) {
VALUE v;
rb_scan_args(argc, argv, "01", &v);
nb = RTEST(v);
VALUE v;
rb_scan_args(argc, argv, "01", &v);
nb = RTEST(v);
}
f = get_fcntl_flags(fptr->fd);
restore[0] = fptr->fd;
restore[1] = f;
if (!io_nonblock_set(fptr->fd, f, nb))
return rb_yield(io);
return rb_yield(io);
return rb_ensure(rb_yield, io, io_nonblock_restore, (VALUE)restore);
}
#else
Expand Down

0 comments on commit 0d842fe

Please sign in to comment.