subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1446103 - /subversion/branches/fsfs-format7/subversion/libsvn_subr/io.c
Date Thu, 14 Feb 2013 10:28:16 GMT
Author: stefan2
Date: Thu Feb 14 10:28:16 2013
New Revision: 1446103

URL: http://svn.apache.org/r1446103
Log:
On the fsfs-format7 branch:   Minimize OS interaction and eliminate
double buffering in stringbuf_from_aprfile() in case the file size
is known.  I.e. don't attempt to read beyond EOF just to detect EOF etc.

* subversion/libsvn_subr/io.c
  (stringbuf_from_aprfile): use a single read request if filesize is known

Modified:
    subversion/branches/fsfs-format7/subversion/libsvn_subr/io.c

Modified: subversion/branches/fsfs-format7/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_subr/io.c?rev=1446103&r1=1446102&r2=1446103&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_subr/io.c Thu Feb 14 10:28:16 2013
@@ -2187,7 +2187,19 @@ stringbuf_from_aprfile(svn_stringbuf_t *
         {
           apr_finfo_t finfo;
           if (! (status = apr_stat(&finfo, filename, APR_FINFO_MIN, pool)))
-            res_initial_len = (apr_size_t)finfo.size;
+            {
+              /* we've got the file length. Now, read it in one go. */
+              svn_boolean_t eof;
+              res_initial_len = (apr_size_t)finfo.size;
+              res = svn_stringbuf_create_ensure(res_initial_len, pool);
+              SVN_ERR(svn_io_file_read_full2(file, res->data,
+                                             res_initial_len, &res->len,
+                                             &eof, pool));
+              res->data[res->len] = 0;
+              
+              *result = res;
+              return SVN_NO_ERROR;
+            }
         }
     }
 



Mime
View raw message