ext/etc/etc.c in etc-1.4.2 vs ext/etc/etc.c in etc-1.4.3

- old
+ new

@@ -52,22 +52,33 @@ #else # ifdef HAVE_STDLIB_H # include <stdlib.h> # endif #endif -char *getlogin(); +RUBY_EXTERN char *getlogin(void); -#define RUBY_ETC_VERSION "1.4.2" +#define RUBY_ETC_VERSION "1.4.3" #ifdef HAVE_RB_DEPRECATE_CONSTANT void rb_deprecate_constant(VALUE mod, const char *name); #else # define rb_deprecate_constant(mod,name) ((void)(mod),(void)(name)) #endif #include "constdefs.h" +#ifndef HAVE_RB_IO_DESCRIPTOR +static int +io_descriptor_fallback(VALUE io) +{ + rb_io_t *fptr; + GetOpenFile(io, fptr); + return fptr->fd; +} +#define rb_io_descriptor io_descriptor_fallback +#endif + #ifdef HAVE_RUBY_ATOMIC_H # include "ruby/atomic.h" #else typedef int rb_atomic_t; # define RUBY_ATOMIC_CAS(var, oldval, newval) \ @@ -939,17 +950,14 @@ static VALUE io_pathconf(VALUE io, VALUE arg) { int name; long ret; - rb_io_t *fptr; name = NUM2INT(arg); - GetOpenFile(io, fptr); - errno = 0; - ret = fpathconf(fptr->fd, name); + ret = fpathconf(rb_io_descriptor(io), name); if (ret == -1) { if (errno == 0) /* no limit */ return Qnil; rb_sys_fail("fpathconf"); }