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: Eric Wong Newsgroups: gmane.comp.lang.ruby.kgio.general Subject: [PATCH 3/3] my_writev: stylistic fixes Date: Wed, 25 Sep 2013 19:42:39 +0000 Message-ID: <1380138159-5350-3-git-send-email-normalperson@yhbt.net> References: <1380138159-5350-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 1380138184 6780 80.91.229.3 (25 Sep 2013 19:43:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Sep 2013 19:43:04 +0000 (UTC) To: kgio@librelist.org Original-X-From: kgio@librelist.org Wed Sep 25 21:43:07 2013 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:234 Archived-At: Received: from zedshaw2.xen.prgmr.com ([71.19.156.177]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VOuzI-0008TY-6Y for gclrkg-kgio@m.gmane.org; Wed, 25 Sep 2013 21:43:04 +0200 Received: from zedshaw2.xen.prgmr.com (unknown [IPv6:::1]) by zedshaw2.xen.prgmr.com (Postfix) with ESMTP id 3F6B1750F3 for ; Wed, 25 Sep 2013 19:53:41 +0000 (UTC) From: Eric Wong Rename 'str' to 'ary', as that's the whole point of supporting writev... Also, long lines need to be wrapped at 80 columns --- ext/kgio/read_write.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ext/kgio/read_write.c b/ext/kgio/read_write.c index 34c619f..fcb48bb 100644 --- a/ext/kgio/read_write.c +++ b/ext/kgio/read_write.c @@ -606,12 +606,12 @@ static int writev_check(struct io_args_v *a, long n, const char *msg, int io_wai return 0; } -static VALUE my_writev(VALUE io, VALUE str, int io_wait) +static VALUE my_writev(VALUE io, VALUE ary, int io_wait) { struct io_args_v a; long n; - prepare_writev(&a, io, str); + prepare_writev(&a, io, ary); set_nonblocking(a.fd); do { @@ -619,12 +619,15 @@ static VALUE my_writev(VALUE io, VALUE str, int io_wait) if (a.iov_cnt == 0) n = 0; else if (a.iov_cnt == 1) - n = (long)write(a.fd, a.vec[0].iov_base, a.vec[0].iov_len); + n = (long)write(a.fd, a.vec[0].iov_base, + a.vec[0].iov_len); /* for big strings use library function */ - else if (USE_WRITEV && a.batch_len / WRITEV_IMPL_THRESHOLD > a.iov_cnt) + else if (USE_WRITEV && + ((a.batch_len / WRITEV_IMPL_THRESHOLD) > a.iov_cnt)) n = (long)writev(a.fd, a.vec, a.iov_cnt); else - n = (long)custom_writev(a.fd, a.vec, a.iov_cnt, a.batch_len); + n = (long)custom_writev(a.fd, a.vec, a.iov_cnt, + a.batch_len); } while (writev_check(&a, n, "writev", io_wait) != 0); rb_str_resize(a.vec_buf, 0); -- 1.8.3.2.701.g8c4e4ec