You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2015/05/27 12:57:48 UTC
svn commit: r1681966 - in /subversion/trunk/subversion:
libsvn_diff/binary_diff.c libsvn_diff/diff_file.c libsvn_fs_fs/stats.c
svnrdump/dump_editor.c tests/libsvn_subr/spillbuf-test.c
Author: ivan
Date: Wed May 27 10:57:47 2015
New Revision: 1681966
URL: http://svn.apache.org/r1681966
Log:
Replace some calls to svn_io_file_info_get() with svn_io_file_size_get()
where it makes sense.
* subversion/libsvn_diff/binary_diff.c
(create_compressed): Use svn_io_file_size_get() and remove now unused
local variable FINFO.
* subversion/libsvn_diff/diff_file.c
(datasources_open): Use svn_io_file_size_get().
* subversion/libsvn_fs_fs/stats.c
(get_file_size): Remove.
(read_phys_pack_file, read_phys_revision_file): Use svn_io_file_size_get()
instead of local helper get_file_size().
* subversion/svnrdump/dump_editor.c
(close_file): Use svn_io_file_size_get() instead of apr_file_info_get()
and remove some legacy error handling.
* subversion/tests/libsvn_subr/spillbuf-test.c
(test_spillbuf__file_attrs): Use svn_io_file_size_get() instead of
svn_io_file_info_get().
Modified:
subversion/trunk/subversion/libsvn_diff/binary_diff.c
subversion/trunk/subversion/libsvn_diff/diff_file.c
subversion/trunk/subversion/libsvn_fs_fs/stats.c
subversion/trunk/subversion/svnrdump/dump_editor.c
subversion/trunk/subversion/tests/libsvn_subr/spillbuf-test.c
Modified: subversion/trunk/subversion/libsvn_diff/binary_diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/binary_diff.c?rev=1681966&r1=1681965&r2=1681966&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/binary_diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/binary_diff.c Wed May 27 10:57:47 2015
@@ -42,7 +42,6 @@ create_compressed(apr_file_t **result,
{
svn_stream_t *compressed;
svn_filesize_t bytes_read = 0;
- apr_finfo_t finfo;
apr_size_t rd;
SVN_ERR(svn_io_open_uniquely_named(result, NULL, NULL, "diffgz",
@@ -77,8 +76,7 @@ create_compressed(apr_file_t **result,
SVN_ERR(svn_stream_close(compressed)); /* Flush compression */
*full_size = bytes_read;
- SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_SIZE, *result, scratch_pool));
- *compressed_size = finfo.size;
+ SVN_ERR(svn_io_file_size_get(compressed_size, *result, scratch_pool));
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff_file.c?rev=1681966&r1=1681965&r2=1681966&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/trunk/subversion/libsvn_diff/diff_file.c Wed May 27 10:57:47 2015
@@ -791,15 +791,14 @@ datasources_open(void *baton,
/* Open datasources and read first chunk */
for (i = 0; i < datasources_len; i++)
{
- apr_finfo_t finfo;
+ svn_filesize_t filesize;
struct file_info *file
= &file_baton->files[datasource_to_index(datasources[i])];
SVN_ERR(svn_io_file_open(&file->file, file->path,
APR_READ, APR_OS_DEFAULT, file_baton->pool));
- SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_SIZE, file->file,
- file_baton->pool));
- file->size = finfo.size;
- length[i] = finfo.size > CHUNK_SIZE ? CHUNK_SIZE : finfo.size;
+ SVN_ERR(svn_io_file_size_get(&filesize, file->file, file_baton->pool));
+ file->size = filesize;
+ length[i] = filesize > CHUNK_SIZE ? CHUNK_SIZE : filesize;
file->buffer = apr_palloc(file_baton->pool, (apr_size_t) length[i]);
SVN_ERR(read_chunk(file->file, file->buffer,
length[i], 0, file_baton->pool));
Modified: subversion/trunk/subversion/libsvn_fs_fs/stats.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/stats.c?rev=1681966&r1=1681965&r2=1681966&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/stats.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/stats.c Wed May 27 10:57:47 2015
@@ -176,23 +176,6 @@ typedef struct query_t
void *cancel_baton;
} query_t;
-/* Return the length of REV_FILE in *FILE_SIZE.
- * Use SCRATCH_POOL for temporary allocations.
- */
-static svn_error_t *
-get_file_size(apr_off_t *file_size,
- svn_fs_fs__revision_file_t *rev_file,
- apr_pool_t *scratch_pool)
-{
- apr_finfo_t finfo;
-
- SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_SIZE, rev_file->file,
- scratch_pool));
-
- *file_size = finfo.size;
- return SVN_NO_ERROR;
-}
-
/* Initialize the LARGEST_CHANGES member in STATS with a capacity of COUNT
* entries. Allocate the result in RESULT_POOL.
*/
@@ -728,12 +711,12 @@ read_phys_pack_file(query_t *query,
{
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
int i;
- apr_off_t file_size = 0;
+ svn_filesize_t file_size = 0;
svn_fs_fs__revision_file_t *rev_file;
SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, query->fs, base,
scratch_pool, scratch_pool));
- SVN_ERR(get_file_size(&file_size, rev_file, scratch_pool));
+ SVN_ERR(svn_io_file_size_get(&file_size, rev_file->file, scratch_pool));
/* process each revision in the pack file */
for (i = 0; i < query->shard_size; ++i)
@@ -797,7 +780,7 @@ read_phys_revision_file(query_t *query,
apr_pool_t *scratch_pool)
{
revision_info_t *info = apr_pcalloc(result_pool, sizeof(*info));
- apr_off_t file_size = 0;
+ svn_filesize_t file_size = 0;
svn_fs_fs__revision_file_t *rev_file;
/* cancellation support */
@@ -807,7 +790,7 @@ read_phys_revision_file(query_t *query,
/* read the whole pack file into memory */
SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, query->fs, revision,
scratch_pool, scratch_pool));
- SVN_ERR(get_file_size(&file_size, rev_file, scratch_pool));
+ SVN_ERR(svn_io_file_size_get(&file_size, rev_file->file, scratch_pool));
/* create the revision info for the current rev */
info->representations = apr_array_make(result_pool, 4, sizeof(rep_stats_t*));
Modified: subversion/trunk/subversion/svnrdump/dump_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/dump_editor.c?rev=1681966&r1=1681965&r2=1681966&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/dump_editor.c (original)
+++ subversion/trunk/subversion/svnrdump/dump_editor.c Wed May 27 10:57:47 2015
@@ -879,7 +879,7 @@ close_file(void *file_baton,
{
struct file_baton *fb = file_baton;
struct dump_edit_baton *eb = fb->eb;
- apr_finfo_t *info = apr_pcalloc(pool, sizeof(apr_finfo_t));
+ svn_filesize_t text_content_length = 0;
svn_stringbuf_t *propstring = NULL;
svn_repos__dumpfile_headers_t *headers;
@@ -903,15 +903,12 @@ close_file(void *file_baton,
/* Dump the text headers */
if (fb->dump_text)
{
- apr_status_t err;
-
/* Text-delta: true */
svn_repos__dumpfile_header_push(
headers, SVN_REPOS_DUMPFILE_TEXT_DELTA, "true");
- err = apr_file_info_get(info, APR_FINFO_SIZE, eb->delta_file);
- if (err)
- SVN_ERR(svn_error_wrap_apr(err, NULL));
+ SVN_ERR(svn_io_file_size_get(&text_content_length, eb->delta_file,
+ pool));
if (fb->base_checksum)
/* Text-delta-base-md5: */
@@ -925,7 +922,7 @@ close_file(void *file_baton,
/* Dump the headers and props now */
SVN_ERR(svn_repos__dump_node_record(eb->stream, headers, propstring,
- fb->dump_text, info->size,
+ fb->dump_text, text_content_length,
FALSE /*content_length_always*/,
pool));
Modified: subversion/trunk/subversion/tests/libsvn_subr/spillbuf-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/spillbuf-test.c?rev=1681966&r1=1681965&r2=1681966&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/spillbuf-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/spillbuf-test.c Wed May 27 10:57:47 2015
@@ -514,7 +514,7 @@ static svn_error_t *
test_spillbuf__file_attrs(apr_pool_t *pool, svn_boolean_t spill_all,
svn_spillbuf_t *buf)
{
- apr_finfo_t finfo;
+ svn_filesize_t filesize;
SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
@@ -528,13 +528,12 @@ test_spillbuf__file_attrs(apr_pool_t *po
SVN_TEST_ASSERT(svn_spillbuf__get_file(buf) != NULL);
/* The size of the file must match expectations */
- SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_SIZE,
- svn_spillbuf__get_file(buf), pool));
+ SVN_ERR(svn_io_file_size_get(&filesize, svn_spillbuf__get_file(buf), pool));
if (spill_all)
- SVN_TEST_ASSERT(finfo.size == svn_spillbuf__get_size(buf));
+ SVN_TEST_ASSERT(filesize == svn_spillbuf__get_size(buf));
else
- SVN_TEST_ASSERT(finfo.size == (svn_spillbuf__get_size(buf)
- - svn_spillbuf__get_memory_size(buf)));
+ SVN_TEST_ASSERT(filesize == (svn_spillbuf__get_size(buf)
+ - svn_spillbuf__get_memory_size(buf)));
return SVN_NO_ERROR;
}