raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: raindrops-public@yhbt.net
Subject: [PATCH] my_fileno: drop Ruby 1.8 support and simplify
Date: Thu,  9 Mar 2023 01:50:01 +0000	[thread overview]
Message-ID: <20230309015001.1979716-1-e@80x24.org> (raw)

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;
 }

                 reply	other threads:[~2023-03-09  1:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://yhbt.net/raindrops/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230309015001.1979716-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=raindrops-public@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	http://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).