subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1360315 - in /subversion/trunk/subversion/libsvn_subr: deprecated.c path.c
Date Wed, 11 Jul 2012 17:41:01 GMT
Author: stefan2
Date: Wed Jul 11 17:41:01 2012
New Revision: 1360315

URL: http://svn.apache.org/viewvc?rev=1360315&view=rev
Log:
Prevent path-handling related deprecation warnings. Since they happen
in code of functons that are deprecated themselves, we need a workaround
here: move the actual code to a static *_internal function and let
the public deprecated API as well as its users call that internal
(non-deprecated) function.

* subversion/libsvn_subr/deprecated.c
  (svn_path_is_canonical): move from here to the next file

* subversion/libsvn_subr/path.c
  (svn_path_is_canonical_internal, 
   svn_path_is_canonical): make the function body available internally
   without deprecation warning
  (svn_path_join_internal,
   svn_path_join): do a similar split; call svn_path_is_canonical_internal
   to prevent deprecation warnings
  (svn_path_join_many,
   svn_path_dirname,
   svn_path_basename, 
   svn_path_decompose): call *_internal functions

Modified:
    subversion/trunk/subversion/libsvn_subr/deprecated.c
    subversion/trunk/subversion/libsvn_subr/path.c

Modified: subversion/trunk/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/deprecated.c?rev=1360315&r1=1360314&r2=1360315&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_subr/deprecated.c Wed Jul 11 17:41:01 2012
@@ -1056,14 +1056,6 @@ svn_path_canonicalize(const char *path, 
     return svn_dirent_canonicalize(path, pool);
 }
 
-svn_boolean_t
-svn_path_is_canonical(const char *path, apr_pool_t *pool)
-{
-  return svn_uri_is_canonical(path, pool) ||
-      svn_dirent_is_canonical(path, pool) ||
-      svn_relpath_is_canonical(path);
-}
-
 
 /*** From mergeinfo.c ***/
 

Modified: subversion/trunk/subversion/libsvn_subr/path.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/path.c?rev=1360315&r1=1360314&r2=1360315&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/path.c (original)
+++ subversion/trunk/subversion/libsvn_subr/path.c Wed Jul 11 17:41:01 2012
@@ -91,16 +91,33 @@ is_canonical(const char *path,
 #endif
 
 
-char *svn_path_join(const char *base,
-                    const char *component,
-                    apr_pool_t *pool)
+/* functionality of svn_path_is_canonical but without the deprecation */
+static svn_boolean_t
+svn_path_is_canonical_internal(const char *path, apr_pool_t *pool)
+{
+  return svn_uri_is_canonical(path, pool) ||
+      svn_dirent_is_canonical(path, pool) ||
+      svn_relpath_is_canonical(path);
+}
+
+svn_boolean_t
+svn_path_is_canonical(const char *path, apr_pool_t *pool)
+{
+  return svn_path_is_canonical_internal(path, pool);
+}
+
+/* functionality of svn_path_join but without the deprecation */
+static char *
+svn_path_join_internal(const char *base,
+                       const char *component,
+                       apr_pool_t *pool)
 {
   apr_size_t blen = strlen(base);
   apr_size_t clen = strlen(component);
   char *path;
 
-  assert(svn_path_is_canonical(base, pool));
-  assert(svn_path_is_canonical(component, pool));
+  assert(svn_path_is_canonical_internal(base, pool));
+  assert(svn_path_is_canonical_internal(component, pool));
 
   /* If the component is absolute, then return it.  */
   if (*component == '/')
@@ -124,6 +141,13 @@ char *svn_path_join(const char *base,
   return path;
 }
 
+char *svn_path_join(const char *base,
+                    const char *component,
+                    apr_pool_t *pool)
+{
+  return svn_path_join_internal(base, component, pool);
+}
+
 char *svn_path_join_many(apr_pool_t *pool, const char *base, ...)
 {
 #define MAX_SAVED_LENGTHS 10
@@ -140,7 +164,7 @@ char *svn_path_join_many(apr_pool_t *poo
 
   total_len = strlen(base);
 
-  assert(svn_path_is_canonical(base, pool));
+  assert(svn_path_is_canonical_internal(base, pool));
 
   if (total_len == 1 && *base == '/')
     base_is_root = TRUE;
@@ -160,7 +184,7 @@ char *svn_path_join_many(apr_pool_t *poo
     {
       len = strlen(s);
 
-      assert(svn_path_is_canonical(s, pool));
+      assert(svn_path_is_canonical_internal(s, pool));
 
       if (SVN_PATH_IS_EMPTY(s))
         continue;
@@ -353,7 +377,7 @@ svn_path_dirname(const char *path, apr_p
 {
   apr_size_t len = strlen(path);
 
-  assert(svn_path_is_canonical(path, pool));
+  assert(svn_path_is_canonical_internal(path, pool));
 
   return apr_pstrmemdup(pool, path, previous_segment(path, len));
 }
@@ -365,7 +389,7 @@ svn_path_basename(const char *path, apr_
   apr_size_t len = strlen(path);
   apr_size_t start;
 
-  assert(svn_path_is_canonical(path, pool));
+  assert(svn_path_is_canonical_internal(path, pool));
 
   if (len == 1 && path[0] == '/')
     start = 0;
@@ -593,7 +617,7 @@ svn_path_decompose(const char *path,
   apr_array_header_t *components =
     apr_array_make(pool, 1, sizeof(const char *));
 
-  assert(svn_path_is_canonical(path, pool));
+  assert(svn_path_is_canonical_internal(path, pool));
 
   if (SVN_PATH_IS_EMPTY(path))
     return components;  /* ### Should we return a "" component? */



Mime
View raw message