From: Eric Wong <normalperson@yhbt.net>
To: kgio@librelist.org
Subject: [PATCH 3/3] my_writev: stylistic fixes
Date: Wed, 25 Sep 2013 19:43:05 +0000 [thread overview]
Message-ID: <1380138185-5435-3-git-send-email-normalperson@yhbt.net> (raw)
In-Reply-To: 1380138185-5435-1-git-send-email-normalperson@yhbt.net
From: Eric Wong <e@yhbt.net>
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
next prev parent reply other threads:[~2013-09-25 19:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 19:43 [PATCH 1/3] tryopen: remove RARRAY_PTR usage in init Eric Wong
2013-09-25 19:43 ` [PATCH 2/3] read_write: remove the rest of RARRAY_PTR usage Eric Wong
2013-09-25 19:43 ` Eric Wong [this message]
2013-09-25 19:44 ` [PATCH 1/3] tryopen: remove RARRAY_PTR usage in init Eric Wong
2013-09-25 21:37 ` Aeon
2013-09-25 22:00 ` Eric Wong
2013-09-26 3:02 ` Aeon
-- strict thread matches above, loose matches on Subject: below --
2013-09-25 19:42 Eric Wong
2013-09-25 19:42 ` [PATCH 3/3] my_writev: stylistic fixes Eric Wong
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=1380138185-5435-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).