Julian Foad wrote:
> Branko Čibej wrote:
>
>> Erik Huelsmann wrote:
>>>
>>> My first revision of a patch for libsvn_client cf issue 897.
>>
>> There are a few more things that could be done for consistency.
> ...
>> * Message texts
>> o Close-file errors: "Failed to close file '%s'" vs. "Error
>> closing file '%s'"
>
> How about I make the following addition so that most invocations of
> apr_file_close can be changed to SVN_ERR (svn_io_file_close) instead of
> being followed by manual construction of an error message?
Committed in r7652. You can now simplify things like this:
Index: subversion/libsvn_client/repos_diff.c
===================================================================
--- subversion/libsvn_client/repos_diff.c (revision 7652)
+++ subversion/libsvn_client/repos_diff.c (working copy)
@@ -314,7 +314,6 @@
static svn_error_t *
get_file_from_ra (struct file_baton *b)
{
- apr_status_t status;
apr_file_t *file;
svn_stream_t *fstream;
const char *temp_dir;
@@ -335,10 +334,7 @@
&(b->pristine_props),
b->pool));
- status = apr_file_close (file);
- if (status)
- return svn_error_createf (status, NULL, "failed to close file '%s'",
- b->path_start_revision);
+ SVN_ERR (svn_io_file_close (file, b->pool));
return SVN_NO_ERROR;
}
@@ -364,7 +360,6 @@
create_empty_file (const char **empty_file,
apr_pool_t *pool)
{
- apr_status_t status;
apr_file_t *file;
const char *temp_dir;
@@ -373,10 +368,7 @@
svn_path_join (temp_dir, "tmp", pool),
"", FALSE, pool));
- status = apr_file_close (file);
- if (status)
- return svn_error_createf (status, NULL,
- "failed to create empty file '%s'", *empty_file);
+ SVN_ERR (svn_io_file_close (file, pool));
return SVN_NO_ERROR;
}
@@ -686,19 +678,8 @@
if (!window)
{
- apr_status_t status;
-
- status = apr_file_close (b->file_start_revision);
- if (status)
- return svn_error_createf (status, NULL,
- "failed to close file '%s'",
- b->path_start_revision);
-
- status = apr_file_close (b->file_end_revision);
- if (status)
- return svn_error_createf (status, NULL,
- "failed to close file '%s'",
- b->path_end_revision);
+ SVN_ERR (svn_io_file_close (b->file_start_revision, b->pool));
+ SVN_ERR (svn_io_file_close (b->file_end_revision, b->pool));
}
return SVN_NO_ERROR;
- Julian
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 6 14:25:11 2003