raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] my_fileno: drop Ruby 1.8 support and simplify
@ 2023-03-09  1:50 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-03-09  1:50 UTC (permalink / raw)
  To: raindrops-public

This project has been 1.9.3+ only for a long time (and likely
going 2.x+-only), so kill some code we don't need.
---
 ext/raindrops/my_fileno.h | 27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/ext/raindrops/my_fileno.h b/ext/raindrops/my_fileno.h
index bdf1a5f..4c8ffba 100644
--- a/ext/raindrops/my_fileno.h
+++ b/ext/raindrops/my_fileno.h
@@ -1,36 +1,15 @@
 #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)
 {
 	rb_io_t *fptr;
-	int fd;
 
 	if (TYPE(io) != T_FILE)
 		io = rb_convert_type(io, T_FILE, "IO", "to_io");
 	GetOpenFile(io, fptr);
-	fd = FPTR_TO_FD(fptr);
 
-	if (fd < 0)
+	if (fptr->fd < 0)
 		rb_raise(rb_eIOError, "closed stream");
-	return fd;
+	return fptr->fd;
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-09  1:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09  1:50 [PATCH] my_fileno: drop Ruby 1.8 support and simplify Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/raindrops.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).