The patch below complements the changes from revision 7660. I did not change
the occurrances of apr_file_close which discard the error code.
bye,
Erik.
PS: The patch is also available
at:
http://encorps.dnsalias.com/patches/libsvn_rest-apr_-to-svn_io_file_close.patch
Log:
[[[
Change the call sequence "apr_file_close, svn_error_create" to
"SVN_ERR (svn_io_file_close (...))" for brevity and consistency, throughout
libsvn_*. This complements the changes made in revision 7660.
]]]
Index: subversion/libsvn_diff/diff_file.c
===================================================================
--- subversion/libsvn_diff/diff_file.c (revision 7674)
+++ subversion/libsvn_diff/diff_file.c (working copy)
@@ -193,12 +193,7 @@
/* Since we have the entire contents of the file we can
* close it now.
*/
- rv = apr_file_close(*file);
- if (rv != APR_SUCCESS)
- {
- return svn_error_createf(rv, NULL, "Failed to close file '%s'.",
- path);
- }
+ SVN_ERR (svn_io_file_close(*file, pool));
*file = NULL;
}
@@ -916,13 +911,7 @@
for (i = 0; i < 2; i++)
{
- apr_status_t rv = apr_file_close(baton.file[i]);
- if (rv != APR_SUCCESS)
- {
- return svn_error_createf(rv, NULL,
- "Failed to close file '%s'.",
- baton.path[i]);
- }
+ SVN_ERR (svn_io_file_close(baton.file[i], pool));
}
}
@@ -1228,12 +1217,7 @@
if (file[idx])
{
- rv = apr_file_close(file[idx]);
- if (rv != APR_SUCCESS)
- {
- return svn_error_createf(rv, NULL, "Failed to close file
'%s'.",
- baton.path[idx]);
- }
+ SVN_ERR (svn_io_file_close(file[idx], pool));
}
}
Index: subversion/libsvn_fs/fs.c
===================================================================
--- subversion/libsvn_fs/fs.c (revision 7674)
+++ subversion/libsvn_fs/fs.c (working copy)
@@ -491,10 +491,7 @@
}
}
- apr_err = apr_file_close (dbconfig_file);
- if (apr_err != APR_SUCCESS)
- return svn_error_createf (apr_err, 0,
- "closing '%s'", dbconfig_file_name);
+ SVN_ERR (svn_io_file_close (dbconfig_file, fs->pool));
}
svn_err = allocate_env (fs);
Index: subversion/libsvn_wc/merge.c
===================================================================
--- subversion/libsvn_wc/merge.c (revision 7674)
+++ subversion/libsvn_wc/merge.c (working copy)
@@ -50,7 +50,6 @@
svn_boolean_t is_binary;
svn_subst_keywords_t *keywords;
const char *eol;
- apr_status_t apr_err;
const svn_wc_entry_t *entry;
svn_boolean_t contains_conflicts;
@@ -82,13 +81,7 @@
merge_target,
SVN_WC__TMP_EXT,
FALSE, pool));
- apr_err = apr_file_close (tmp_f);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_wc_merge: unable to close tmp file '%s'",
- tmp_target);
-
+ SVN_ERR (svn_io_file_close (tmp_f, pool));
SVN_ERR (svn_io_copy_file (merge_target,
tmp_target, TRUE, pool));
}
@@ -107,22 +100,12 @@
tmp_target,
SVN_WC__TMP_EXT,
FALSE, pool));
- apr_err = apr_file_close (tmp_f);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_wc_merge: unable to close tmp file '%s'",
- tmp_left);
-
+ SVN_ERR (svn_io_file_close (tmp_f, pool));
SVN_ERR (svn_io_open_unique_file (&tmp_f, &tmp_right,
tmp_target,
SVN_WC__TMP_EXT,
FALSE, pool));
- apr_err = apr_file_close (tmp_f);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_wc_merge: unable to close tmp file '%s'", tmp_right);
+ SVN_ERR (svn_io_file_close (tmp_f, pool));
SVN_ERR (svn_io_copy_file (left, tmp_left, TRUE, pool));
SVN_ERR (svn_io_copy_file (right, tmp_right, TRUE, pool));
@@ -180,11 +163,7 @@
}
/* Close the output file */
- apr_err = apr_file_close (result_f);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_wc_merge: unable to close tmp file '%s'", result_target);
+ SVN_ERR (svn_io_file_close (result_f, pool));
if (contains_conflicts && ! dry_run) /* got a conflict */
{
@@ -204,13 +183,8 @@
left_label,
FALSE,
pool));
+ SVN_ERR (svn_io_file_close (lcopy_f, pool));
- apr_err = apr_file_close (lcopy_f);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_wc_merge: unable to close tmp file '%s'", left_copy);
-
/* Have I mentioned how much I miss Lisp? */
SVN_ERR (svn_io_open_unique_file (&rcopy_f,
@@ -219,13 +193,8 @@
right_label,
FALSE,
pool));
+ SVN_ERR (svn_io_file_close (rcopy_f, pool));
- apr_err = apr_file_close (rcopy_f);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_wc_merge: unable to close tmp file '%s'", right_copy);
-
/* Why, how much more pleasant to be forced to unroll my loops.
If I'd been writing in Lisp, I might have mapped an inline
lambda form over a list, or something equally disgusting.
@@ -237,13 +206,8 @@
target_label,
FALSE,
pool));
+ SVN_ERR (svn_io_file_close (tcopy_f, pool));
- apr_err = apr_file_close (tcopy_f);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_wc_merge: unable to close tmp file '%s'", target_copy);
-
/* We preserve all the files with keywords expanded and line
endings in local (working) form. */
@@ -356,11 +320,7 @@
left_label,
FALSE,
pool));
- apr_err = apr_file_close (lcopy_f);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_wc_merge: unable to close tmp file '%s'", left_copy);
+ SVN_ERR (svn_io_file_close (lcopy_f, pool));
SVN_ERR (svn_io_open_unique_file (&rcopy_f,
&right_copy,
@@ -368,11 +328,7 @@
right_label,
FALSE,
pool));
- apr_err = apr_file_close (rcopy_f);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_wc_merge: unable to close tmp file '%s'", right_copy);
+ SVN_ERR (svn_io_file_close (rcopy_f, pool));
/* create the backup files */
SVN_ERR (svn_io_copy_file (left,
Index: subversion/libsvn_wc/props.c
===================================================================
--- subversion/libsvn_wc/props.c (revision 7674)
+++ subversion/libsvn_wc/props.c (working copy)
@@ -171,11 +171,7 @@
"load_prop_file: can't parse '%s'",
propfile_path);
- status = apr_file_close (propfile);
- if (status)
- return svn_error_createf (status, NULL,
- "load_prop_file: can't close '%s'",
- propfile_path);
+ SVN_ERR (svn_io_file_close (propfile, pool));
}
return SVN_NO_ERROR;
@@ -205,11 +201,7 @@
"save_prop_file: can't write prop hash to
'%s'",
propfile_path);
- apr_err = apr_file_close (prop_tmp);
- if (apr_err)
- return svn_error_createf (apr_err, NULL,
- "save_prop_file: can't close '%s'",
- propfile_path);
+ SVN_ERR (svn_io_file_close (prop_tmp, pool));
return SVN_NO_ERROR;
}
@@ -644,12 +636,7 @@
/* First, _close_ this temporary conflicts file. We've been
appending to it all along. */
- apr_status_t status;
- status = apr_file_close (reject_tmp_fp);
- if (status)
- return svn_error_createf (status, NULL,
- "do_property_merge: can't close '%s'",
- reject_tmp_path);
+ SVN_ERR (svn_io_file_close (reject_tmp_fp, pool));
/* Now try to get the name of a pre-existing .prej file from the
entries file */
@@ -677,11 +664,7 @@
FALSE,
pool));
- status = apr_file_close (reject_fp);
- if (status)
- return svn_error_createf (status, NULL,
- "do_property_merge: can't close
'%s'",
- full_reject_path);
+ SVN_ERR (svn_io_file_close (reject_fp, pool));
/* This file will be overwritten when the log is run; that's
ok, because at least now we have a reservation on
Index: subversion/libsvn_wc/adm_crawler.c
===================================================================
--- subversion/libsvn_wc/adm_crawler.c (revision 7674)
+++ subversion/libsvn_wc/adm_crawler.c (working copy)
@@ -593,7 +593,6 @@
apr_pool_t *pool)
{
const char *tmpf, *tmp_base;
- apr_status_t status;
svn_txdelta_window_handler_t handler;
void *wh_baton;
svn_txdelta_stream_t *txdelta_stream;
@@ -713,9 +712,7 @@
wh_baton, pool));
/* Close the two files */
- if ((status = apr_file_close (localfile)))
- return svn_error_create (status, NULL,
- "error closing local file");
+ SVN_ERR (svn_io_file_close (localfile, pool));
if (basefile)
SVN_ERR (svn_wc__close_text_base (basefile, path, 0, pool));
Index: subversion/libsvn_wc/log.c
===================================================================
--- subversion/libsvn_wc/log.c (revision 7674)
+++ subversion/libsvn_wc/log.c (working copy)
@@ -209,7 +209,6 @@
const char *tmp_text_base;
svn_node_kind_t kind;
svn_subst_keywords_t *keywords;
- apr_status_t apr_err;
apr_file_t *ignored;
svn_boolean_t same, did_set;
const char *tmp_wfile, *pdir, *bname;
@@ -247,11 +246,7 @@
SVN_ERR (svn_io_open_unique_file (&ignored, &tmp_wfile,
tmp_wfile, SVN_WC__TMP_EXT,
FALSE, pool));
- apr_err = apr_file_close (ignored);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "install_committed_file: error closing '%s'", tmp_wfile);
+ SVN_ERR (svn_io_file_close (ignored, pool));
/* Is there a tmp_text_base that needs to be installed? */
tmp_text_base = svn_wc__text_base_path (filepath, 1, pool);
Index: subversion/libsvn_wc/adm_files.c
===================================================================
--- subversion/libsvn_wc/adm_files.c (revision 7674)
+++ subversion/libsvn_wc/adm_files.c (working copy)
@@ -168,7 +168,6 @@
{
svn_error_t *err = SVN_NO_ERROR;
apr_file_t *f = NULL;
- apr_status_t apr_err = 0;
const char *path;
SVN_ERR (svn_wc__adm_write_check (adm_access));
@@ -184,9 +183,7 @@
pool));
/* Creation succeeded, so close immediately. */
- apr_err = apr_file_close (f);
- if (apr_err)
- err = svn_error_create (apr_err, NULL, path);
+ SVN_ERR (svn_io_file_close (f, pool));
}
else if (type == svn_node_dir)
{
@@ -211,7 +208,6 @@
maybe_copy_file (const char *src, const char *dst, apr_pool_t *pool)
{
svn_node_kind_t kind;
- apr_status_t apr_err;
/* First test if SRC exists. */
SVN_ERR (svn_io_check_path (src, &kind, pool));
@@ -224,11 +220,7 @@
(APR_WRITE | APR_CREATE),
APR_OS_DEFAULT,
pool));
- apr_err = apr_file_close (f);
- if (apr_err)
- return svn_error_create (apr_err, NULL, dst);
- else
- return SVN_NO_ERROR;
+ SVN_ERR (svn_io_file_close (f, pool));
}
else /* SRC exists, so copy it to DST. */
{
@@ -505,7 +497,6 @@
apr_pool_t *pool,
...)
{
- apr_status_t apr_err = 0;
const char *tmp_path;
va_list ap;
@@ -514,11 +505,8 @@
tmp_path = v_extend_with_adm_name (path, extension, sync, pool, ap);
va_end (ap);
- apr_err = apr_file_close (fp);
+ SVN_ERR (svn_io_file_close (fp, pool));
- if (apr_err)
- return svn_error_create (apr_err, NULL, tmp_path);
-
/* If we're syncing a tmp file, it needs to be renamed after closing. */
if (sync)
{
Index: subversion/libsvn_wc/translate.c
===================================================================
--- subversion/libsvn_wc/translate.c (revision 7674)
+++ subversion/libsvn_wc/translate.c (working copy)
@@ -68,7 +68,6 @@
else /* some translation is necessary */
{
const char *tmp_dir, *tmp_vfile;
- apr_status_t apr_err;
apr_file_t *ignored;
/* First, reserve a tmp file name. */
@@ -87,11 +86,7 @@
/* We were just reserving the name and don't actually need the
filehandle, so close immediately. */
- apr_err = apr_file_close (ignored);
- if (apr_err)
- return svn_error_createf
- (0, NULL,
- "svn_wc_translated_file: unable to close '%s'", tmp_vfile);
+ SVN_ERR (svn_io_file_close (ignored, pool));
if (style == svn_subst_eol_style_fixed)
{
Index: subversion/libsvn_subr/subst.c
===================================================================
--- subversion/libsvn_subr/subst.c (revision 7674)
+++ subversion/libsvn_subr/subst.c (working copy)
@@ -760,14 +760,9 @@
SVN_ERR (svn_stream_close (src_stream));
SVN_ERR (svn_stream_close (dst_stream));
- apr_err = apr_file_close(s);
- if (apr_err)
- return svn_error_createf (apr_err, NULL, "error closing '%s'", src);
+ SVN_ERR (svn_io_file_close (s, pool));
+ SVN_ERR (svn_io_file_close (d, pool));
- apr_err = apr_file_close(d);
- if (apr_err)
- return svn_error_createf (apr_err, NULL, "error closing '%s'", dst);
-
/* Now that dst_tmp contains the translated data, do the atomic rename.
*/
SVN_ERR (svn_io_file_rename (dst_tmp, dst, pool));
Index: subversion/libsvn_subr/config_file.c
===================================================================
--- subversion/libsvn_subr/config_file.c (revision 7674)
+++ subversion/libsvn_subr/config_file.c (working copy)
@@ -775,10 +775,7 @@
return svn_error_createf (apr_err, NULL,
"writing config file '%s'", path);
- apr_err = apr_file_close (f);
- if (apr_err)
- return svn_error_createf (apr_err, NULL,
- "closing config file '%s'", path);
+ SVN_ERR (svn_io_file_close (f, pool));
}
}
@@ -885,10 +882,7 @@
return svn_error_createf (apr_err, NULL,
"writing config file '%s'", path);
- apr_err = apr_file_close (f);
- if (apr_err)
- return svn_error_createf (apr_err, NULL,
- "closing config file '%s'", path);
+ SVN_ERR (svn_io_file_close (f, pool));
}
}
@@ -1014,10 +1008,7 @@
return svn_error_createf (apr_err, NULL,
"writing config file '%s'", path);
- apr_err = apr_file_close (f);
- if (apr_err)
- return svn_error_createf (apr_err, NULL,
- "closing config file '%s'", path);
+ SVN_ERR (svn_io_file_close (f, pool));
}
}
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 7674)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -341,13 +341,7 @@
SVN_ERR (svn_io_open_unique_file (&d, &dst_tmp, dst, ".tmp", FALSE,
pool));
SVN_ERR (svn_path_cstring_from_utf8 (&dst_tmp_apr, dst_tmp, pool));
- apr_err = apr_file_close (d);
- if (apr_err)
- {
- return svn_error_createf
- (apr_err, NULL,
- "svn_io_copy_file: error closing '%s'", dst_tmp);
- }
+ SVN_ERR (svn_io_file_close (d, pool));
apr_err = apr_file_copy (src_apr, dst_tmp_apr, APR_OS_DEFAULT, pool);
if (apr_err)
@@ -383,11 +377,7 @@
"svn_io_copy_file: getting perm info for '%s'", src);
}
- apr_err = apr_file_close (s);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_io_copy_file: closing '%s' after reading perms", src);
+ SVN_ERR (svn_io_file_close (s, pool));
apr_err = apr_file_perms_set (dst_tmp_apr, finfo.protection);
@@ -619,10 +609,8 @@
return svn_error_createf
(apr_err, NULL, "svn_io_file_create: error writing '%s'", file);
- apr_err = apr_file_close (f);
- if (apr_err)
- return svn_error_createf (apr_err, NULL,
- "svn_io_file_create: error closing '%s'",
file);
+ SVN_ERR (svn_io_file_close (f, pool));
+
return SVN_NO_ERROR;
}
@@ -757,11 +745,7 @@
} while (! APR_STATUS_IS_EOF(apr_err));
- apr_err = apr_file_close (f);
- if (apr_err)
- return svn_error_createf
- (apr_err, NULL,
- "svn_io_file_checksum: error closing '%s'", file);
+ SVN_ERR (svn_io_file_close (f, pool));
apr_md5_final (digest, &context);
@@ -984,11 +968,8 @@
SVN_ERR (svn_stringbuf_from_aprfile (result, f, pool));
- apr_err = apr_file_close (f);
- if (apr_err)
- return svn_error_createf (apr_err, NULL,
- "svn_stringbuf_from_file: failed to close
'%s'",
- filename);
+ SVN_ERR (svn_io_file_close (f, pool));
+
return SVN_NO_ERROR;
}
@@ -2171,9 +2152,7 @@
return svn_error_createf (apr_err, 0, "writing to '%s'", path);
/* ...and close the file. */
- apr_err = apr_file_close (format_file);
- if (apr_err)
- return svn_error_createf (apr_err, 0, "closing '%s'", path);
+ SVN_ERR (svn_io_file_close (format_file, pool));
return SVN_NO_ERROR;
}
@@ -2223,9 +2202,7 @@
*version = atoi (buf);
/* And finally, close the file. */
- apr_err = apr_file_close (format_file);
- if (apr_err)
- return svn_error_createf (apr_err, 0, "closing '%s'", path);
+ SVN_ERR (svn_io_file_close (format_file, pool));
return SVN_NO_ERROR;
}
@@ -2278,18 +2255,9 @@
}
}
- status = apr_file_close (file1_h);
- if (status)
- return svn_error_createf
- (status, NULL,
- "contents_identical_p: failed to close '%s'.", file1);
+ SVN_ERR (svn_io_file_close (file1_h, pool));
+ SVN_ERR (svn_io_file_close (file2_h, pool));
- status = apr_file_close (file2_h);
- if (status)
- return svn_error_createf
- (status, NULL,
- "contents_identical_p: failed to close '%s'.", file2);
-
return SVN_NO_ERROR;
}
Index: subversion/libsvn_subr/config_auth.c
===================================================================
--- subversion/libsvn_subr/config_auth.c (revision 7674)
+++ subversion/libsvn_subr/config_auth.c (working copy)
@@ -100,10 +100,7 @@
return svn_error_createf (status, NULL,
"error parsing '%s'", auth_path);
- status = apr_file_close (authfile);
- if (status)
- return svn_error_createf (status, NULL,
- "can't close '%s'", auth_path);
+ SVN_ERR (svn_io_file_close (authfile, pool));
}
return SVN_NO_ERROR;
@@ -143,10 +140,7 @@
return svn_error_createf (status, NULL,
"error writing hash to '%s'", auth_path);
- status = apr_file_close (authfile);
- if (status)
- return svn_error_createf (status, NULL,
- "can't close '%s'", auth_path);
+ SVN_ERR (svn_io_file_close (authfile, pool));
/* To be nice, remove the realmstring from the hash again, just in
case the caller wants their hash unchanged. */
--
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService
Jetzt kostenlos anmelden unter http://www.gmx.net
+++ GMX - die erste Adresse für Mail, Message, More! +++
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Nov 8 09:42:29 2003