librelist archives

« back to archive

[PATCH] work around lack of rb_io_get_io in Rubinius

[PATCH] work around lack of rb_io_get_io in Rubinius

From:
Eric Wong
Date:
2013-11-21 @ 18:48
https://github.com/rubinius/rubinius/issues/2771
---
 ext/sleepy_penguin/util.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ext/sleepy_penguin/util.c b/ext/sleepy_penguin/util.c
index 9d2123f..2c17e1a 100644
--- a/ext/sleepy_penguin/util.c
+++ b/ext/sleepy_penguin/util.c
@@ -1,5 +1,13 @@
 #include "sleepy_penguin.h"
 
+#ifndef HAVE_RB_IO_GET_IO
+static VALUE my_io_get_io(VALUE io)
+{
+	return rb_convert_type(io, T_FILE, "IO", "to_io");
+}
+#  define rb_io_get_io(io) my_io_get_io((io))
+#endif /* HAVE_RB_IO_GET_IO */
+
 static VALUE klass_for(VALUE klass)
 {
 	return (TYPE(klass) == T_CLASS) ? klass : CLASS_OF(klass);
-- 
1.8.5.rc2.1.g2f4e96a