repo.or.cz
/
kgio.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
my_fileno: drop Ruby 1.8 support, really require 1.9.3
[kgio.git]
/
ext
/
kgio
/
my_fileno.h
blob
6dbd08365d6dd6c8be77cce2c2b1bac6cc808952
1
#include <ruby.h>
2
#include <ruby/io.h>
3
4
static int
my_fileno
(
VALUE io
)
5
{
6
#ifdef HAVE_RB_IO_DESCRIPTOR
7
if
(
TYPE
(
io
) !=
T_FILE
)
8
io
=
rb_io_get_io
(
io
);
9
10
return
rb_io_descriptor
(
io
);
11
#else
12
rb_io_t
*
fptr
;
13
int
fd
;
14
15
if
(
TYPE
(
io
) !=
T_FILE
)
16
io
=
rb_io_get_io
(
io
);
17
GetOpenFile
(
io
,
fptr
);
18
rb_io_check_closed
(
fptr
);
19
return
fptr
->
fd
;
20
#endif
21
}