apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r157231 - apr/apr/trunk/file_io/unix/fullrw.c
Date Sat, 12 Mar 2005 05:21:23 GMT
Author: pquerna
Date: Fri Mar 11 21:21:19 2005
New Revision: 157231

URL: http://svn.apache.org/viewcvs?view=rev&rev=157231
Log:
rewrite apr_file_writev_full.

Modified:
    apr/apr/trunk/file_io/unix/fullrw.c

Modified: apr/apr/trunk/file_io/unix/fullrw.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/file_io/unix/fullrw.c?view=diff&r1=157230&r2=157231
==============================================================================
--- apr/apr/trunk/file_io/unix/fullrw.c (original)
+++ apr/apr/trunk/file_io/unix/fullrw.c Fri Mar 11 21:21:19 2005
@@ -67,30 +67,19 @@
                                                apr_size_t nvec,
                                                apr_size_t *bytes_written)
 {
-    apr_status_t status;
+    apr_status_t rv = APR_SUCCESS;
+    int i;
+    apr_size_t amt = 0;
     apr_size_t total = 0;
 
-    do {
-        apr_size_t i, amt;
-        status = apr_file_writev(thefile, vec, nvec, &amt);
- 
-       /* We assume that writev will only write complete iovec areas.
-        * Incomplete writes inside a single area are not supported.
-        * This should be safe according to SuS v2. 
-        */
-        for (i = 0; i < nvec; i++) {
-            total += vec[i].iov_len;
-            if (total >= amt) {
-                vec = &vec[i+1];
-                nvec -= i+1;
-                break;
-            }
-        }
-    } while (status == APR_SUCCESS && nvec > 0);
+    for (i = 0; i < nvec && rv == APR_SUCCESS; i++) {
+        rv = apr_file_write_full(thefile, vec[i].iov_base, 
+                                 vec[i].iov_len, &amt);
+        total += amt;
+    }
 
     if (bytes_written != NULL)
         *bytes_written = total;
 
-    return status;
+    return rv;
 }
-



Mime
View raw message