* io.c (rb_io_advise): removed unused variable, and fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a0e62485d4
commit
594ab9c8fd
30
io.c
30
io.c
@ -7408,7 +7408,8 @@ io_advise_internal(void *arg)
|
|||||||
return posix_fadvise(ptr->fd, ptr->offset, ptr->len, ptr->advice);
|
return posix_fadvise(ptr->fd, ptr->offset, ptr->len, ptr->advice);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE io_advise_sym_to_const(VALUE sym)
|
static VALUE
|
||||||
|
io_advise_sym_to_const(VALUE sym)
|
||||||
{
|
{
|
||||||
#ifdef POSIX_FADV_NORMAL
|
#ifdef POSIX_FADV_NORMAL
|
||||||
if (sym == sym_normal)
|
if (sym == sym_normal)
|
||||||
@ -7518,26 +7519,25 @@ do_io_advise(rb_io_t *fptr, VALUE advice, off_t offset, off_t len)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_io_advise(int argc, VALUE *argv, VALUE io)
|
rb_io_advise(int argc, VALUE *argv, VALUE io)
|
||||||
{
|
{
|
||||||
int rv;
|
VALUE advice, offset, len;
|
||||||
VALUE advice, offset, len;
|
off_t off, l;
|
||||||
off_t off, l;
|
rb_io_t *fptr;
|
||||||
rb_io_t *fptr;
|
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "12", &advice, &offset, &len);
|
rb_scan_args(argc, argv, "12", &advice, &offset, &len);
|
||||||
if (TYPE(advice) != T_SYMBOL)
|
if (!SYMBOL_P(advice))
|
||||||
rb_raise(rb_eTypeError, "advice must be a Symbol");
|
rb_raise(rb_eTypeError, "advice must be a Symbol");
|
||||||
|
|
||||||
io = GetWriteIO(io);
|
io = GetWriteIO(io);
|
||||||
GetOpenFile(io, fptr);
|
GetOpenFile(io, fptr);
|
||||||
|
|
||||||
off = NIL_P(offset) ? 0 : NUM2OFFT(offset);
|
off = NIL_P(offset) ? 0 : NUM2OFFT(offset);
|
||||||
l = NIL_P(len) ? 0 : NUM2OFFT(len);
|
l = NIL_P(len) ? 0 : NUM2OFFT(len);
|
||||||
|
|
||||||
#ifdef HAVE_POSIX_FADVISE
|
#ifdef HAVE_POSIX_FADVISE
|
||||||
return do_io_advise(fptr, advice, off, l);
|
return do_io_advise(fptr, advice, off, l);
|
||||||
#else
|
#else
|
||||||
/* Ignore all hint */
|
/* Ignore all hint */
|
||||||
return Qnil;
|
return Qnil;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user