* [PATCH 1/3] my_fileno: drop Ruby 1.8 support, really require 1.9.3
2023-09-10 18:49 7% [PATCH 0/3] remove some Ruby 1.8 codepaths Eric Wong
@ 2023-09-10 18:49 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-09-10 18:49 UTC (permalink / raw)
To: kgio-public
I have no idea if 1.8 has worked in a while, but maybe it has.
`rb_io_get_io' has been public API since Ruby 1.9.2, so we can
use it everywhere. `rb_io_check_closed' has existed since the
initial cvs2svn imports of Ruby, so it's safe to depend on for
Ruby v1.9.3..v3.0.
---
ext/kgio/my_fileno.h | 32 +++++---------------------------
kgio.gemspec | 1 +
2 files changed, 6 insertions(+), 27 deletions(-)
diff --git a/ext/kgio/my_fileno.h b/ext/kgio/my_fileno.h
index d9bda3c..6dbd083 100644
--- a/ext/kgio/my_fileno.h
+++ b/ext/kgio/my_fileno.h
@@ -1,30 +1,11 @@
#include <ruby.h>
-#ifdef HAVE_RUBY_IO_H
-# include <ruby/io.h>
-#else
-# include <stdio.h>
-# include <rubyio.h>
-#endif
-
-#if ! HAVE_RB_IO_T
-# define rb_io_t OpenFile
-#endif
-
-#ifdef GetReadFile
-# define FPTR_TO_FD(fptr) (fileno(GetReadFile(fptr)))
-#else
-# if !HAVE_RB_IO_T || (RUBY_VERSION_MAJOR == 1 && RUBY_VERSION_MINOR == 8)
-# define FPTR_TO_FD(fptr) fileno(fptr->f)
-# else
-# define FPTR_TO_FD(fptr) fptr->fd
-# endif
-#endif
+#include <ruby/io.h>
static int my_fileno(VALUE io)
{
#ifdef HAVE_RB_IO_DESCRIPTOR
if (TYPE(io) != T_FILE)
- io = rb_convert_type(io, T_FILE, "IO", "to_io");
+ io = rb_io_get_io(io);
return rb_io_descriptor(io);
#else
@@ -32,12 +13,9 @@ static int my_fileno(VALUE io)
int fd;
if (TYPE(io) != T_FILE)
- io = rb_convert_type(io, T_FILE, "IO", "to_io");
+ io = rb_io_get_io(io);
GetOpenFile(io, fptr);
- fd = FPTR_TO_FD(fptr);
-
- if (fd < 0)
- rb_raise(rb_eIOError, "closed stream");
- return fd;
+ rb_io_check_closed(fptr);
+ return fptr->fd;
#endif
}
diff --git a/kgio.gemspec b/kgio.gemspec
index 1c3f26a..edba39f 100644
--- a/kgio.gemspec
+++ b/kgio.gemspec
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
# s.add_development_dependency('strace_me', '~> 1.0') # Linux only
s.licenses = %w(LGPL-2.1+)
+ s.required_ruby_version = '>= 1.9.3' # kgio is deprecated anyways...
end
^ permalink raw reply related [relevance 7%]
* [PATCH 0/3] remove some Ruby 1.8 codepaths
@ 2023-09-10 18:49 7% Eric Wong
2023-09-10 18:49 7% ` [PATCH 1/3] my_fileno: drop Ruby 1.8 support, really require 1.9.3 Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-09-10 18:49 UTC (permalink / raw)
To: kgio-public
I haven't been motivated to build 1.8 in ages due to
toolchain changes in distros.
Eric Wong (3):
my_fileno: drop Ruby 1.8 support, really require 1.9.3
sock_for_fd: drop 1.8/1.9/2.x/3.0-specific hacks
drop remaining 1.8 and fragile autopush code paths
ext/kgio/ancient_ruby.h | 24 -----------------
ext/kgio/autopush.c | 21 ---------------
ext/kgio/extconf.rb | 18 -------------
ext/kgio/kgio.h | 8 +-----
ext/kgio/my_fileno.h | 32 ++++------------------
ext/kgio/set_file_path.h | 22 ---------------
ext/kgio/sock_for_fd.h | 58 +---------------------------------------
ext/kgio/tryopen.c | 32 +---------------------
kgio.gemspec | 1 +
lib/kgio.rb | 5 ++++
10 files changed, 14 insertions(+), 207 deletions(-)
delete mode 100644 ext/kgio/ancient_ruby.h
^ permalink raw reply [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-09-10 18:49 7% [PATCH 0/3] remove some Ruby 1.8 codepaths Eric Wong
2023-09-10 18:49 7% ` [PATCH 1/3] my_fileno: drop Ruby 1.8 support, really require 1.9.3 Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/kgio.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).