about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2013-09-25 19:37:22 +0000
committerEric Wong <normalperson@yhbt.net>2013-09-25 19:41:28 +0000
commitfc91f1d424af2a94d0fbed4b1f4d0171c8add79f (patch)
tree5e234ca3abd06288d0775d0a9ea2b1bd8aa07940
parent13725d97e0c493cc38a4c833c1053216fb5c799b (diff)
downloadkgio-fc91f1d424af2a94d0fbed4b1f4d0171c8add79f.tar.gz
Rename 'str' to 'ary', as that's the whole point of supporting
writev...  Also, long lines need to be wrapped at 80 columns
-rw-r--r--ext/kgio/read_write.c13
1 files 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);