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/03/04 19:15:39 UTC

svn commit: r919106 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c adm_files.h

Author: julianfoad
Date: Thu Mar  4 18:15:39 2010
New Revision: 919106

URL: http://svn.apache.org/viewvc?rev=919106&view=rev
Log:
Declare that two more WC functions always use absolute paths.

* subversion/libsvn_wc/adm_files.h,
  subversion/libsvn_wc/adm_files.c
  (open_adm_file, svn_wc__open_writable_base): Rename path parameters to
    indicate they are always absolute paths. No code changes are necessary.
    (Each has only one caller and the caller already supplies absolute paths
    as input.)

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_files.c
    subversion/trunk/subversion/libsvn_wc/adm_files.h

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=919106&r1=919105&r2=919106&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Thu Mar  4 18:15:39 2010
@@ -374,17 +374,17 @@
 /*** Opening and closing files in the adm area. ***/
 
 /* Create and open a writable file in the admin temporary area of the WC
-   directory PATH, in a subdirectory named SUBDIR (such as "text-base"),
+   directory DIR_ABSPATH, in a subdirectory named SUBDIR (such as "text-base"),
    with the name FNAME and extra EXTENSION (such as ".svn-base").  If the
    file already exists, first delete it.  Set *STREAM to a writable stream
-   to this file, and (if SELECTED_PATH is not NULL) set *SELECTED_PATH to
+   to this file, and (if SELECTED_ABSPATH is not NULL) set *SELECTED_PATH to
    the path to this file, both allocated in RESULT_POOL.
 
    Closing the stream will close (but not delete) the file. */
 static svn_error_t *
 open_adm_file(svn_stream_t **stream,
-              const char **selected_path,
-              const char *path,
+              const char **selected_abspath,
+              const char *dir_abspath,
               const char *subdir,
               const char *fname,
               const char *extension,
@@ -394,18 +394,18 @@
   svn_error_t *err;
 
   /* Extend with tmp name. */
-  path = extend_with_adm_name(path, extension, TRUE, result_pool,
-                              subdir, fname, NULL);
-  if (selected_path)
-    *selected_path = path;  /* note: built in result_pool */
+  dir_abspath = extend_with_adm_name(dir_abspath, extension, TRUE, result_pool,
+                                     subdir, fname, NULL);
+  if (selected_abspath)
+    *selected_abspath = dir_abspath;  /* note: built in result_pool */
 
-  err = svn_stream_open_writable(stream, path, result_pool, scratch_pool);
+  err = svn_stream_open_writable(stream, dir_abspath, result_pool, scratch_pool);
   if (err && APR_STATUS_IS_EEXIST(err->apr_err))
     {
       /* Exclusive open failed, delete and retry */
       svn_error_clear(err);
-      SVN_ERR(svn_io_remove_file2(path, FALSE, scratch_pool));
-      err = svn_stream_open_writable(stream, path, result_pool, scratch_pool);
+      SVN_ERR(svn_io_remove_file2(dir_abspath, FALSE, scratch_pool));
+      err = svn_stream_open_writable(stream, dir_abspath, result_pool, scratch_pool);
     }
 
   /* Examine the error from the first and/or second attempt at opening. */
@@ -442,19 +442,19 @@
 
 svn_error_t *
 svn_wc__open_writable_base(svn_stream_t **stream,
-                           const char **temp_base_path,
-                           const char *path,
+                           const char **temp_base_abspath,
+                           const char *local_abspath,
                            svn_boolean_t need_revert_base,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
 {
-  const char *parent_path;
+  const char *parent_abspath;
   const char *base_name;
 
-  svn_dirent_split(path, &parent_path, &base_name, scratch_pool);
+  svn_dirent_split(local_abspath, &parent_abspath, &base_name, scratch_pool);
 
-  return open_adm_file(stream, temp_base_path,
-                       parent_path,
+  return open_adm_file(stream, temp_base_abspath,
+                       parent_abspath,
                        SVN_WC__ADM_TEXT_BASE,
                        base_name,
                        need_revert_base

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.h?rev=919106&r1=919105&r2=919106&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.h (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.h Thu Mar  4 18:15:39 2010
@@ -116,15 +116,16 @@
                                      apr_pool_t *scratch_pool);
 
 
-/* Open the normal or revert text base, associated with PATH, for writing.
+/* Open the normal or revert text base, associated with LOCAL_ABSPATH, for
+   writing.
    The selection is based on NEED_REVERT_BASE. The opened stream will be
    returned in STREAM and the selected path will be returned in,
-   TEMP_BASE_PATH, and both will be allocated in RESULT_POOL. Any temporary
+   TEMP_BASE_ABSPATH, and both will be allocated in RESULT_POOL. Any temporary
    allocations will be performed in SCRATCH_POOL. */
 svn_error_t *
 svn_wc__open_writable_base(svn_stream_t **stream,
-                           const char **temp_base_path,
-                           const char *path,
+                           const char **temp_base_abspath,
+                           const char *local_abspath,
                            svn_boolean_t need_revert_base,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool);



Re: svn commit: r919106 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c adm_files.h

Posted by Julian Foad <ju...@wandisco.com>.
On Fri, 2010-03-05, Greg Stein wrote:
> On Thu, Mar 4, 2010 at 13:15,  <ju...@apache.org> wrote:
> > Author: julianfoad
> > Date: Thu Mar  4 18:15:39 2010
> > New Revision: 919106
> >
> > URL: http://svn.apache.org/viewvc?rev=919106&view=rev
> > Log:
> > Declare that two more WC functions always use absolute paths.
> >
> > * subversion/libsvn_wc/adm_files.h,
> >  subversion/libsvn_wc/adm_files.c
> >  (open_adm_file, svn_wc__open_writable_base): Rename path parameters to
> >    indicate they are always absolute paths. No code changes are necessary.
> >    (Each has only one caller and the caller already supplies absolute paths
> >    as input.)
> 
> With only one caller, it may not be important, but we've also tended
> to add assertions that the parameter is an absolute path. It is very
> advisable for long-term APIs. I would expect both of these functions
> to disappear, so it isn't that big of a deal, but I wanted to mention
> the precedent.

Good plan. r920279.

- Julian


Re: svn commit: r919106 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c adm_files.h

Posted by Greg Stein <gs...@gmail.com>.
On Thu, Mar 4, 2010 at 13:15,  <ju...@apache.org> wrote:
> Author: julianfoad
> Date: Thu Mar  4 18:15:39 2010
> New Revision: 919106
>
> URL: http://svn.apache.org/viewvc?rev=919106&view=rev
> Log:
> Declare that two more WC functions always use absolute paths.
>
> * subversion/libsvn_wc/adm_files.h,
>  subversion/libsvn_wc/adm_files.c
>  (open_adm_file, svn_wc__open_writable_base): Rename path parameters to
>    indicate they are always absolute paths. No code changes are necessary.
>    (Each has only one caller and the caller already supplies absolute paths
>    as input.)

With only one caller, it may not be important, but we've also tended
to add assertions that the parameter is an absolute path. It is very
advisable for long-term APIs. I would expect both of these functions
to disappear, so it isn't that big of a deal, but I wanted to mention
the precedent.

>...

Cheers,
-g