You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/08/08 13:29:23 UTC

svn commit: r983385 - in /subversion/branches/performance/subversion: include/private/svn_file_handle_cache.h include/svn_io.h libsvn_fs_fs/fs_fs.c libsvn_subr/stream.c

Author: stefan2
Date: Sun Aug  8 11:29:23 2010
New Revision: 983385

URL: http://svn.apache.org/viewvc?rev=983385&view=rev
Log:
Since svn_file_handle_cache__handle_t is not art of the public API,
svn_stream_from_cached_file_handle shouldn't be as well.

Therefore, move the declaration to a private header and rename the
function to indicate that it is private, too. Because the streams created
are performance critical and to minimize copy'n'paste code, the stream
implementation remains in stream.c .

* subversion/libsvn_subr/stream.c
  (svn_stream__from_cached_file_handle): rename from svn_stream_from_cached_file_handle
* subversion/libsvn_fs_fs/fs_fs.c
  (get_node_revision_body, read_window): adapt to renamed API
* subversion/include/svn_io.h
  (svn_stream_from_cached_file_handle, svn_file_handle_cache__handle_t): remove here
* subversion/private/svn_cache.h
  (svn_stream__from_cached_file_handle): moved function declaration 

Modified:
    subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h
    subversion/branches/performance/subversion/include/svn_io.h
    subversion/branches/performance/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/performance/subversion/libsvn_subr/stream.c

Modified: subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h?rev=983385&r1=983384&r2=983385&view=diff
==============================================================================
--- subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h (original)
+++ subversion/branches/performance/subversion/include/private/svn_file_handle_cache.h Sun Aug  8 11:29:23 2010
@@ -24,8 +24,7 @@
  * @brief File handle cache API
  */
 
-#include <apr_file_io.h>
-#include "svn_types.h"
+#include "svn_io.h"
 
 /**
  * An opaque structure representing a cache for open file handles.
@@ -86,6 +85,21 @@ svn_file_handle_cache__get_apr_handle(sv
 const char *
 svn_file_handle_cache__get_name(svn_file_handle_cache__handle_t *f);
 
+/** Create a stream from a cached file handle.  For convenience, if @a file
+ * is @c NULL, an empty stream created by svn_stream_empty() is returned.
+ *
+ * This function should normally be called with @a disown set to FALSE,
+ * in which case closing the stream will also return the file handle to
+ * the respective cache object.
+ *
+ * If @a disown is TRUE, the stream will disown the file handle, meaning 
+ * that svn_stream_close() will not close the cached file handle.
+ */
+svn_stream_t *
+svn_stream__from_cached_file_handle(svn_file_handle_cache__handle_t *file,
+                                    svn_boolean_t disown,
+                                    apr_pool_t *pool);
+
 /**
  * Return the cached file handle @a f to the cache. Depending on the number
  * of open handles, the underlying handle may actually get closed. If @a f
@@ -113,3 +127,4 @@ svn_file_handle_cache__create_cache(svn_
                                     size_t max_handles,
                                     svn_boolean_t thread_safe,
                                     apr_pool_t *pool);
+

Modified: subversion/branches/performance/subversion/include/svn_io.h
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/include/svn_io.h?rev=983385&r1=983384&r2=983385&view=diff
==============================================================================
--- subversion/branches/performance/subversion/include/svn_io.h (original)
+++ subversion/branches/performance/subversion/include/svn_io.h Sun Aug  8 11:29:23 2010
@@ -923,9 +923,6 @@ svn_stream_from_aprfile2(apr_file_t *fil
                          svn_boolean_t disown,
                          apr_pool_t *pool);
 
-/* "forward-declare" svn_file_handle_cache__handle_t */
-struct svn_file_handle_cache__handle_t;
-
 /** Similar to svn_stream_from_aprfile2(), except that the file will
  * always be disowned.
  *
@@ -940,24 +937,6 @@ svn_stream_t *
 svn_stream_from_aprfile(apr_file_t *file,
                         apr_pool_t *pool);
 
-/** Create a stream from a cached file handle.  For convenience, if @a file
- * is @c NULL, an empty stream created by svn_stream_empty() is returned.
- *
- * This function should normally be called with @a disown set to FALSE,
- * in which case closing the stream will also return the file handle to
- * the respective cache object.
- *
- * If @a disown is TRUE, the stream will disown the file handle, meaning 
- * that svn_stream_close() will not close the cached file handle.
- *
- * @since New in 1.7.
- */
-svn_stream_t *
-svn_stream_from_cached_file_handle
-    (struct svn_file_handle_cache__handle_t *file,
-     svn_boolean_t disown,
-     apr_pool_t *pool);
-
 /** Create a stream for reading from a range of an APR file.
  * The stream cannot be written to.
  *

Modified: subversion/branches/performance/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_fs_fs/fs_fs.c?rev=983385&r1=983384&r2=983385&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/performance/subversion/libsvn_fs_fs/fs_fs.c Sun Aug  8 11:29:23 2010
@@ -2125,7 +2125,7 @@ get_node_revision_body(node_revision_t *
     }
 
   return svn_fs_fs__read_noderev(noderev_p,
-                                 svn_stream_from_cached_file_handle
+                                 svn_stream__from_cached_file_handle
                                      (revision_file,
                                       FALSE,
                                       pool),
@@ -3150,7 +3150,7 @@ read_window(svn_txdelta_window_t **nwin,
     }
 
   /* Read the next window. */
-  stream = svn_stream_from_cached_file_handle(rs->file, TRUE, pool);
+  stream = svn_stream__from_cached_file_handle(rs->file, TRUE, pool);
   SVN_ERR(svn_txdelta_read_svndiff_window(nwin, stream, rs->ver, pool));
   rs->chunk_index++;
   SVN_ERR(get_file_offset(&rs->off, rs->apr_file, pool));

Modified: subversion/branches/performance/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/stream.c?rev=983385&r1=983384&r2=983385&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/stream.c Sun Aug  8 11:29:23 2010
@@ -782,9 +782,9 @@ svn_stream_from_aprfile2(apr_file_t *fil
 }
 
 svn_stream_t *
-svn_stream_from_cached_file_handle(svn_file_handle_cache__handle_t *file,
-                                   svn_boolean_t disown,
-                                   apr_pool_t *pool)
+svn_stream__from_cached_file_handle(svn_file_handle_cache__handle_t *file,
+                                    svn_boolean_t disown,
+                                    apr_pool_t *pool)
 {
   struct baton_apr *baton;