Author: hwright
Date: Mon Oct 25 16:55:30 2010
New Revision: 1027192

URL: http://svn.apache.org/viewvc?rev=1027192&view=rev
Log:
Merge r985500 from the performance branch.

This revision removes some redundant encoding of temp file names.

(While functionally correct, I think some of the function names could be
improved, but that's a bikeshed we can have on trunk.)

Modified:
    subversion/trunk/   (props changed)
    subversion/trunk/subversion/libsvn_subr/io.c

Propchange: subversion/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Oct 25 16:55:30 2010
@@ -23,7 +23,7 @@
 /subversion/branches/log-g-performance:870941-871032
 /subversion/branches/merge-skips-obstructions:874525-874615
 /subversion/branches/nfc-nfd-aware-client:870276,870376
-/subversion/branches/performance:982355,983764,983766,984927,985014,985037,985046,985472,985477,985669,987888,987893,995507,995603,1001413,1025660
+/subversion/branches/performance:982355,983764,983766,984927,985014,985037,985046,985472,985477,985500,985669,987888,987893,995507,995603,1001413,1025660
 /subversion/branches/ra_serf-digest-authn:875693-876404
 /subversion/branches/reintegrate-improvements:873853-874164
 /subversion/branches/subtree-mergeinfo:876734-878766

Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1027192&r1=1027191&r2=1027192&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Mon Oct 25 16:55:30 2010
@@ -818,6 +818,29 @@ file_perms_set(const char *fname, apr_fi
   else
     return SVN_NO_ERROR;
 }
+
+/* Set permissions PERMS on the FILE. This is a cheaper variant of the 
+ * file_perms_set wrapper() function because no locale-dependent string
+ * conversion is required. 
+ */
+static svn_error_t *
+file_perms_set2(apr_file_t* file, apr_fileperms_t perms)
+{
+  const char *fname_apr;
+  apr_status_t status;
+
+  status = apr_file_name_get(&fname_apr, file);
+  if (status)
+    return svn_error_wrap_apr(status, _("Can't get file name"));
+
+  status = apr_file_perms_set(fname_apr, perms);
+  if (status)
+    return svn_error_wrap_apr(status, _("Can't set permissions on '%s'"),
+                              fname_apr);
+  else
+    return SVN_NO_ERROR;
+}
+
 #endif /* !WIN32 && !__OS2__ */
 
 svn_error_t *
@@ -3854,7 +3877,7 @@ svn_io_open_unique_file3(apr_file_t **fi
    * ### So we tweak perms of the tempfile here, but only if the umask
    * ### allows it. */
   SVN_ERR(merge_default_file_perms(tempfile, &perms, scratch_pool));
-  SVN_ERR(file_perms_set(tempname, perms, scratch_pool));
+  SVN_ERR(file_perms_set2(tempfile, perms));
 #endif
 
   if (file)


Reply via email to