about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-02-05 07:43:42 +0000
committerEric Wong <e@80x24.org>2014-02-05 07:43:42 +0000
commitf33a875c88680bcca52ba216f8c540b432407af6 (patch)
treee3c99806313510eb08d4c56b77ab68a511ec62e3
parent815b8379cb1f7fa8bb9c104913fbf66e3260181d (diff)
downloadkgio-f33a875c88680bcca52ba216f8c540b432407af6.tar.gz
Some errors in the code reorganization caused some compatibility
code to be dropped :x
-rw-r--r--ext/kgio/kgio.h6
-rw-r--r--ext/kgio/write.c5
-rw-r--r--ext/kgio/writev.c11
3 files changed, 17 insertions, 5 deletions
diff --git a/ext/kgio/kgio.h b/ext/kgio/kgio.h
index 4ccd7c2..6c5da5b 100644
--- a/ext/kgio/kgio.h
+++ b/ext/kgio/kgio.h
@@ -96,4 +96,10 @@ static inline void kgio_autopush_write(VALUE io) { }
 #else
 static inline void kgio_autopush_write(VALUE io) { kgio_autopush_send(io); }
 #endif
+
+/* prefer rb_str_subseq because we don't use negative offsets */
+#ifndef HAVE_RB_STR_SUBSEQ
+#define rb_str_subseq rb_str_substr
+#endif
+
 #endif /* KGIO_H */
diff --git a/ext/kgio/write.c b/ext/kgio/write.c
index ad34bdd..fa152d8 100644
--- a/ext/kgio/write.c
+++ b/ext/kgio/write.c
@@ -4,11 +4,6 @@
 #include "nonblock.h"
 static VALUE sym_wait_writable;
 
-/* prefer rb_str_subseq because we don't use negative offsets */
-#ifndef HAVE_RB_STR_SUBSEQ
-#define rb_str_subseq rb_str_substr
-#endif
-
 struct wr_args {
         VALUE io;
         VALUE buf;
diff --git a/ext/kgio/writev.c b/ext/kgio/writev.c
index a723b68..aafc6d8 100644
--- a/ext/kgio/writev.c
+++ b/ext/kgio/writev.c
@@ -19,6 +19,17 @@ static ssize_t assert_writev(int fd, void* iov, int len)
 }
 #  define writev assert_writev
 #endif
+
+#ifndef HAVE_RB_ARY_SUBSEQ
+static inline VALUE my_ary_subseq(VALUE ary, long idx, long len)
+{
+       VALUE args[2] = { LONG2FIX(idx), LONG2FIX(len) };
+
+       return rb_ary_aref(2, args, ary);
+}
+#define rb_ary_subseq my_ary_subseq
+#endif
+
 static VALUE sym_wait_writable;
 
 #ifndef HAVE_WRITEV