From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS47066 71.19.144.0/20 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: normalperson@yhbt.net Newsgroups: gmane.comp.lang.ruby.kgio.general Subject: [PATCH 2/2] various 1.8.7 fixes Date: Wed, 5 Feb 2014 07:56:47 +0000 Message-ID: <1391587007-30124-3-git-send-email-normalperson@yhbt.net> References: <1391587007-30124-1-git-send-email-normalperson@yhbt.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1391587019 32276 80.91.229.3 (5 Feb 2014 07:56:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Feb 2014 07:56:59 +0000 (UTC) To: kgio@librelist.org Original-X-From: kgio@librelist.org Wed Feb 05 08:57:07 2014 Return-path: Envelope-to: gclrkg-kgio@m.gmane.org List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Precedence: list Original-Sender: kgio@librelist.org Xref: news.gmane.org gmane.comp.lang.ruby.kgio.general:263 Archived-At: Received: from zedshaw2.xen.prgmr.com ([71.19.156.177]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WAxM1-0005Aj-FB for gclrkg-kgio@m.gmane.org; Wed, 05 Feb 2014 08:57:05 +0100 Received: from zedshaw2.xen.prgmr.com (unknown [IPv6:::1]) by zedshaw2.xen.prgmr.com (Postfix) with ESMTP id B262874B2F for ; Wed, 5 Feb 2014 08:05:19 +0000 (UTC) From: Eric Wong 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