From: normalperson@yhbt.net
To: kgio@librelist.org
Subject: [PATCH 2/2] various 1.8.7 fixes
Date: Wed, 5 Feb 2014 07:56:47 +0000 [thread overview]
Message-ID: <1391587007-30124-3-git-send-email-normalperson@yhbt.net> (raw)
In-Reply-To: 1391587007-30124-1-git-send-email-normalperson@yhbt.net
From: Eric Wong <e@80x24.org>
Some errors in the code reorganization caused some compatibility
code to be dropped :x
---
ext/kgio/kgio.h | 6 ++++++
ext/kgio/write.c | 5 -----
ext/kgio/writev.c | 11 +++++++++++
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
--
1.8.5.3.368.gab0bcec
prev parent reply other threads:[~2014-02-05 7:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-05 7:56 [PATCH 0/2] Ruby 1.8 fixes normalperson
2014-02-05 7:56 ` [PATCH 1/2] only define and test kgio_syssend on 1.9+ normalperson
2014-02-05 7:56 ` normalperson [this message]
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: https://yhbt.net/kgio/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391587007-30124-3-git-send-email-normalperson@yhbt.net \
--to=normalperson@yhbt.net \
--cc=kgio@librelist.org \
/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
https://yhbt.net/kgio.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).