You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/11/24 17:27:07 UTC

svn commit: r1038677 - /subversion/trunk/subversion/libsvn_subr/dirent_uri.c

Author: julianfoad
Date: Wed Nov 24 16:27:07 2010
New Revision: 1038677

URL: http://svn.apache.org/viewvc?rev=1038677&view=rev
Log:
Assert that arguments to relpath functions are actually relpaths.

* subversion/libsvn_subr/dirent_uri.c
  (svn_relpath_get_longest_ancestor, svn_relpath_is_child,
   svn_relpath_is_ancestor, svn_relpath_skip_ancestor): Assert that
    the path arguments are relpaths.

Modified:
    subversion/trunk/subversion/libsvn_subr/dirent_uri.c

Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=1038677&r1=1038676&r2=1038677&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Wed Nov 24 16:27:07 2010
@@ -1428,6 +1428,9 @@ svn_relpath_get_longest_ancestor(const c
                                  const char *relpath2,
                                  apr_pool_t *pool)
 {
+  assert(relpath_is_canonical(relpath1));
+  assert(relpath_is_canonical(relpath2));
+
   return apr_pstrndup(pool, relpath1,
                       get_longest_ancestor_length(type_relpath, relpath1,
                                                   relpath2, pool));
@@ -1503,6 +1506,9 @@ svn_relpath_is_child(const char *parent_
                      const char *child_relpath,
                      apr_pool_t *pool)
 {
+  assert(relpath_is_canonical(parent_relpath));
+  assert(relpath_is_canonical(child_relpath));
+
   return is_child(type_relpath, parent_relpath, child_relpath, pool);
 }
 
@@ -1523,6 +1529,9 @@ svn_dirent_is_ancestor(const char *paren
 svn_boolean_t
 svn_relpath_is_ancestor(const char *parent_relpath, const char *child_relpath)
 {
+  assert(relpath_is_canonical(parent_relpath));
+  assert(relpath_is_canonical(child_relpath));
+
   return is_ancestor(type_relpath, parent_relpath, child_relpath);
 }
 
@@ -1569,6 +1578,9 @@ svn_relpath_skip_ancestor(const char *pa
 {
   apr_size_t len = strlen(parent_relpath);
 
+  assert(relpath_is_canonical(parent_relpath));
+  assert(relpath_is_canonical(child_relpath));
+
   if (0 != memcmp(parent_relpath, child_relpath, len))
     return child_relpath; /* parent_relpath is no ancestor of child_relpath */