subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject svn commit: r1718923 - /subversion/trunk/subversion/libsvn_repos/commit.c
Date Wed, 09 Dec 2015 17:41:52 GMT
Author: ivan
Date: Wed Dec  9 17:41:52 2015
New Revision: 1718923

URL: http://svn.apache.org/viewvc?rev=1718923&view=rev
Log:
Use existing helper to simplify code a bit.

* subversion/libsvn_repos/commit.c
  (add_file_or_directory): Use svn_cstring_skip_prefix() instead of strncmp().

Modified:
    subversion/trunk/subversion/libsvn_repos/commit.c

Modified: subversion/trunk/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/commit.c?rev=1718923&r1=1718922&r2=1718923&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/commit.c (original)
+++ subversion/trunk/subversion/libsvn_repos/commit.c Wed Dec  9 17:41:52 2015
@@ -324,7 +324,6 @@ add_file_or_directory(const char *path,
       const char *fs_path;
       svn_fs_root_t *copy_root;
       svn_node_kind_t kind;
-      size_t repos_url_len;
       svn_repos_authz_access_t required;
 
       /* Copy requires recursive write access to the destination path
@@ -346,14 +345,12 @@ add_file_or_directory(const char *path,
       /* For now, require that the url come from the same repository
          that this commit is operating on. */
       copy_path = svn_path_uri_decode(copy_path, subpool);
-      repos_url_len = strlen(eb->repos_url_decoded);
-      if (strncmp(copy_path, eb->repos_url_decoded, repos_url_len) != 0)
+      fs_path = svn_cstring_skip_prefix(copy_path, eb->repos_url_decoded);
+      if (!fs_path)
         return svn_error_createf
           (SVN_ERR_FS_GENERAL, NULL,
            _("Source url '%s' is from different repository"), copy_path);
 
-      fs_path = apr_pstrdup(subpool, copy_path + repos_url_len);
-
       /* Now use the "fs_path" as an absolute path within the
          repository to make the copy from. */
       SVN_ERR(svn_fs_revision_root(&copy_root, eb->fs,



Mime
View raw message