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 2016/05/29 13:23:26 UTC
svn commit: r1746006 - in /subversion/trunk/subversion/libsvn_fs_fs:
cached_data.c low_level.c low_level.h
Author: stefan2
Date: Sun May 29 13:23:25 2016
New Revision: 1746006
URL: http://svn.apache.org/viewvc?rev=1746006&view=rev
Log:
Replicate r1744981 in FSFS:
Add a limit parameter to the low-level changed paths list parser.
In this commit, the callers will never set a true limit, though.
* subversion/libsvn_fs_fs/low_level.h
(svn_fs_fs__read_changes): Add MAX_COUNT parameter.
* subversion/libsvn_fs_fs/low_level.c
(svn_fs_fs__read_changes): Limit the result to MAX_COUNT entries.
* subversion/libsvn_fs_fs/cached_data.c
(svn_fs_fs__get_changes,
block_read_changes): Update callers. However, don't impose an
actual limit other than what is already
implied by the APR array data structure.
Modified:
subversion/trunk/subversion/libsvn_fs_fs/cached_data.c
subversion/trunk/subversion/libsvn_fs_fs/low_level.c
subversion/trunk/subversion/libsvn_fs_fs/low_level.h
Modified: subversion/trunk/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/cached_data.c?rev=1746006&r1=1746005&r2=1746006&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/cached_data.c Sun May 29 13:23:25 2016
@@ -2975,6 +2975,7 @@ svn_fs_fs__get_changes(apr_array_header_
NULL, changes_offset, scratch_pool));
SVN_ERR(svn_fs_fs__read_changes(changes,
context->revision_file->stream,
+ INT_MAX,
result_pool, scratch_pool));
/* cache for future reference */
@@ -3390,8 +3391,8 @@ block_read_changes(apr_array_header_t **
SVN_ERR(read_item(&stream, fs, rev_file, entry, scratch_pool));
/* read changes from revision file */
- SVN_ERR(svn_fs_fs__read_changes(changes, stream, result_pool,
- scratch_pool));
+ SVN_ERR(svn_fs_fs__read_changes(changes, stream, INT_MAX,
+ result_pool, scratch_pool));
/* cache for future reference */
if (ffd->changes_cache)
Modified: subversion/trunk/subversion/libsvn_fs_fs/low_level.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/low_level.c?rev=1746006&r1=1746005&r2=1746006&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/low_level.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/low_level.c Sun May 29 13:23:25 2016
@@ -482,10 +482,10 @@ read_change(change_t **change_p,
svn_error_t *
svn_fs_fs__read_changes(apr_array_header_t **changes,
svn_stream_t *stream,
+ int max_count,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- change_t *change;
apr_pool_t *iterpool;
/* Pre-allocate enough room for most change lists.
@@ -498,13 +498,16 @@ svn_fs_fs__read_changes(apr_array_header
*/
*changes = apr_array_make(result_pool, 63, sizeof(change_t *));
- SVN_ERR(read_change(&change, stream, result_pool, scratch_pool));
iterpool = svn_pool_create(scratch_pool);
- while (change)
+ for (; max_count > 0; --max_count)
{
- APR_ARRAY_PUSH(*changes, change_t*) = change;
- SVN_ERR(read_change(&change, stream, result_pool, iterpool));
+ change_t *change;
svn_pool_clear(iterpool);
+ SVN_ERR(read_change(&change, stream, result_pool, iterpool));
+ if (!change)
+ break;
+
+ APR_ARRAY_PUSH(*changes, change_t*) = change;
}
svn_pool_destroy(iterpool);
Modified: subversion/trunk/subversion/libsvn_fs_fs/low_level.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/low_level.h?rev=1746006&r1=1746005&r2=1746006&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/low_level.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/low_level.h Sun May 29 13:23:25 2016
@@ -97,11 +97,13 @@ svn_fs_fs__unparse_footer(apr_off_t l2p_
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
-/* Read all the changes from STREAM and store them in *CHANGES,
- allocated in RESULT_POOL. Do temporary allocations in SCRATCH_POOL. */
+/* Read up to MAX_COUNT of the changes from STREAM and store them in
+ *CHANGES, allocated in RESULT_POOL. Do temporary allocations in
+ SCRATCH_POOL. */
svn_error_t *
svn_fs_fs__read_changes(apr_array_header_t **changes,
svn_stream_t *stream,
+ int max_count,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);