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 2010/08/14 16:38:59 UTC

svn commit: r985500 - /subversion/branches/performance/subversion/libsvn_subr/io.c

Author: stefan2
Date: Sat Aug 14 14:38:58 2010
New Revision: 985500

URL: http://svn.apache.org/viewvc?rev=985500&view=rev
Log:
Speed up svn_io_open_unique_file3() on UNIX systems: There is no need to convert
the file path to locale encoding. Instead, just get the APR-compatible file name directly
from the APR.

* subversion/libsvn_subr/io.c
  (file_perms_set2): new local variant of file_perms_set() with different signature
  (svn_io_open_unique_file3): use the cheaper file_perms_set2

Modified:
    subversion/branches/performance/subversion/libsvn_subr/io.c

Modified: subversion/branches/performance/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/io.c?rev=985500&r1=985499&r2=985500&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/io.c Sat Aug 14 14:38:58 2010
@@ -834,6 +834,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 *
@@ -3895,7 +3918,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)