raindrops.git  about / heads / tags
real-time stats for preforking Rack servers
   commit 09a2f8678e7eddfc604ca7284fec81e278b774bc (patch)
   parent a8dfec2 avoid unnecessary #to_io calls
     tree ade724584f5b36bde4c947969054770d19a252d9
   author Eric Wong <bofh@yhbt.net>  2023-06-11 21:33:26 +0000
committer Eric Wong <bofh@yhbt.net>  2023-06-26 09:16:38 +0000

my_fileno: use rb_io_check_closed for Ruby <3.1

This is less code and hopefully smaller binaries.
`rb_io_check_closed' has been in Ruby since the pre-CVS of
decades ago, and it doesn't matter if it's removed or not
in the future since Ruby 3.1+ doesn't see this code path
and calls `rb_io_descriptor' directly.
---
 ext/raindrops/my_fileno.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ext/raindrops/my_fileno.h b/ext/raindrops/my_fileno.h
index 646f31b..3a0100f 100644
--- a/ext/raindrops/my_fileno.h
+++ b/ext/raindrops/my_fileno.h
@@ -9,9 +9,8 @@ static int my_fileno(VALUE io)
 	rb_io_t *fptr;
 
 	GetOpenFile(io, fptr);
+	rb_io_check_closed(fptr);
 
-	if (fptr->fd < 0)
-		rb_raise(rb_eIOError, "closed stream");
 	return fptr->fd;
 }
 #endif /* Ruby <3.1 !HAVE_RB_IO_DESCRIPTOR */


glossary
--------
Commit objects reference one tree, and zero or more parents.

Single parent commits can typically generate a patch in
unified diff format via `git format-patch'.

Multiple parents means the commit is a merge.

Root commits have no ancestor.  Note that it is
possible to have multiple root commits when merging independent histories.

Every commit references one top-level tree object.

git clone http://yhbt.net/raindrops.git