subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r985493 - /subversion/branches/performance/subversion/libsvn_subr/io.c
Date Sat, 14 Aug 2010 13:59:40 GMT
Author: stefan2
Date: Sat Aug 14 13:59:40 2010
New Revision: 985493

URL: http://svn.apache.org/viewvc?rev=985493&view=rev
Log:
Reimplement svn_io_file_write_full() for Windows in terms of apr_file_write() instead
of *_write_full() since we already implement the "_full" part here and don't need that
overhead on the APR layer.

* subversion/libsvn_subr/io.c
  (svn_io_file_write_full): reimplement using basic apr_file_write()

Modified:
    subversion/branches/performance/subversion/libsvn_subr/io.c

Modified: subversion/branches/performance/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/io.c?rev=985493&r1=985492&r2=985493&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/io.c Sat Aug 14 13:59:40 2010
@@ -2950,25 +2950,25 @@ svn_io_file_write_full(apr_file_t *file,
                        apr_size_t nbytes, apr_size_t *bytes_written,
                        apr_pool_t *pool)
 {
-  apr_status_t rv = apr_file_write_full(file, buf, nbytes, bytes_written);
-
 #ifdef WIN32
 #define MAXBUFSIZE 30*1024
-  if (rv == APR_FROM_OS_ERROR(ERROR_NOT_ENOUGH_MEMORY)
-      && nbytes > MAXBUFSIZE)
-    {
-      apr_size_t bw = 0;
-      *bytes_written = 0;
-
-      do {
-        rv = apr_file_write_full(file, buf,
-                                 nbytes > MAXBUFSIZE ? MAXBUFSIZE : nbytes, &bw);
-        *bytes_written += bw;
-        buf = (char *)buf + bw;
-        nbytes -= bw;
-      } while (rv == APR_SUCCESS && nbytes > 0);
-    }
+  apr_status_t rv;
+  apr_size_t bw = 0;
+  apr_size_t to_write = nbytes;
+
+  do {
+    bw = to_write > MAXBUFSIZE ? MAXBUFSIZE : to_write;
+    rv = apr_file_write(file, buf, &bw);
+    buf = (char *)buf + bw;
+    to_write -= bw;
+  } while (rv == APR_SUCCESS && to_write > 0);
+
+  /* bytes_written may actually be NULL */
+  if (bytes_written)
+    *bytes_written = nbytes - to_write;
 #undef MAXBUFSIZE
+#else
+  apr_status_t rv = apr_file_write_full(file, buf, nbytes, bytes_written);
 #endif
 
   return svn_error_return(do_io_file_wrapper_cleanup(



Mime
View raw message