You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2011/05/20 17:28:07 UTC

svn commit: r1125429 - in /subversion/trunk/subversion/libsvn_wc: lock.c workqueue.c

Author: gstein
Date: Fri May 20 15:28:06 2011
New Revision: 1125429

URL: http://svn.apache.org/viewvc?rev=1125429&view=rev
Log:
Remove some ### markers by simple code rearrangement. No functional changes.

* subversion/libsvn_wc/lock.c:
  (do_close): needless forward decl removed
  (add_to_shared, get_from_shared, close_single): moved further up the
    file in order to remove forward declarations.

* subversion/libsvn_wc/workqueue.c:
  (dispatch_work_item): needless forward decl removed
  (svn_wc__wq_build_file_copy_translated): remove ### comment since we are
    already translating to relative paths

Modified:
    subversion/trunk/subversion/libsvn_wc/lock.c
    subversion/trunk/subversion/libsvn_wc/workqueue.c

Modified: subversion/trunk/subversion/libsvn_wc/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/lock.c?rev=1125429&r1=1125428&r2=1125429&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/lock.c (original)
+++ subversion/trunk/subversion/libsvn_wc/lock.c Fri May 20 15:28:06 2011
@@ -83,23 +83,6 @@ static const svn_wc_adm_access_t missing
 #define svn_wc__db_is_closed(db) FALSE
 
 
-
-/* ### these functions are here for forward references. generally, they're
-   ### here to avoid the code churn from moving the definitions.  */
-
-static svn_error_t *
-do_close(svn_wc_adm_access_t *adm_access, svn_boolean_t preserve_lock,
-         apr_pool_t *scratch_pool);
-
-static svn_error_t *
-add_to_shared(svn_wc_adm_access_t *lock, apr_pool_t *scratch_pool);
-
-static svn_error_t *
-close_single(svn_wc_adm_access_t *adm_access,
-             svn_boolean_t preserve_lock,
-             apr_pool_t *scratch_pool);
-
-
 svn_error_t *
 svn_wc__internal_check_wc(int *wc_format,
                           svn_wc__db_t *db,
@@ -216,6 +199,100 @@ svn_wc_check_wc2(int *wc_format,
 }
 
 
+/* */
+static svn_error_t *
+add_to_shared(svn_wc_adm_access_t *lock, apr_pool_t *scratch_pool)
+{
+  /* ### sometimes we replace &missing with a now-valid lock.  */
+  {
+    svn_wc_adm_access_t *prior = svn_wc__db_temp_get_access(lock->db,
+                                                            lock->abspath,
+                                                            scratch_pool);
+    if (IS_MISSING(prior))
+      SVN_ERR(svn_wc__db_temp_close_access(lock->db, lock->abspath,
+                                           prior, scratch_pool));
+  }
+
+  svn_wc__db_temp_set_access(lock->db, lock->abspath, lock,
+                             scratch_pool);
+
+  return SVN_NO_ERROR;
+}
+
+
+/* */
+static svn_wc_adm_access_t *
+get_from_shared(const char *abspath,
+                svn_wc__db_t *db,
+                apr_pool_t *scratch_pool)
+{
+  /* We closed the DB when it became empty. ABSPATH is not present.  */
+  if (db == NULL)
+    return NULL;
+  return svn_wc__db_temp_get_access(db, abspath, scratch_pool);
+}
+
+
+/* */
+static svn_error_t *
+close_single(svn_wc_adm_access_t *adm_access,
+             svn_boolean_t preserve_lock,
+             apr_pool_t *scratch_pool)
+{
+  svn_boolean_t locked;
+
+  if (adm_access->closed)
+    return SVN_NO_ERROR;
+
+  /* Physically unlock if required */
+  SVN_ERR(svn_wc__db_wclock_owns_lock(&locked, adm_access->db,
+                                      adm_access->abspath, TRUE,
+                                      scratch_pool));
+  if (locked)
+    {
+      if (!preserve_lock)
+        {
+          /* Remove the physical lock in the admin directory for
+             PATH. It is acceptable for the administrative area to
+             have disappeared, such as when the directory is removed
+             from the working copy.  It is an error for the lock to
+             have disappeared if the administrative area still exists. */
+
+          svn_error_t *err = svn_wc__db_wclock_release(adm_access->db,
+                                                       adm_access->abspath,
+                                                       scratch_pool);
+          if (err)
+            {
+              if (svn_wc__adm_area_exists(adm_access->abspath, scratch_pool))
+                return err;
+              svn_error_clear(err);
+            }
+        }
+    }
+
+  /* Reset to prevent further use of the lock. */
+  adm_access->closed = TRUE;
+
+  /* Detach from set */
+  SVN_ERR(svn_wc__db_temp_close_access(adm_access->db, adm_access->abspath,
+                                       adm_access, scratch_pool));
+
+  /* Possibly close the underlying wc_db. */
+  if (!adm_access->db_provided)
+    {
+      apr_hash_t *opened = svn_wc__db_temp_get_all_access(adm_access->db,
+                                                          scratch_pool);
+      if (apr_hash_count(opened) == 0)
+        {
+          SVN_ERR(svn_wc__db_close(adm_access->db));
+          adm_access->db = NULL;
+        }
+    }
+
+  return SVN_NO_ERROR;
+}
+
+
 /* Cleanup for a locked access baton.
 
    This handles closing access batons when their pool gets destroyed.
@@ -415,40 +492,6 @@ adm_access_alloc(svn_wc_adm_access_t **a
 
 /* */
 static svn_error_t *
-add_to_shared(svn_wc_adm_access_t *lock, apr_pool_t *scratch_pool)
-{
-  /* ### sometimes we replace &missing with a now-valid lock.  */
-  {
-    svn_wc_adm_access_t *prior = svn_wc__db_temp_get_access(lock->db,
-                                                            lock->abspath,
-                                                            scratch_pool);
-    if (IS_MISSING(prior))
-      SVN_ERR(svn_wc__db_temp_close_access(lock->db, lock->abspath,
-                                           prior, scratch_pool));
-  }
-
-  svn_wc__db_temp_set_access(lock->db, lock->abspath, lock,
-                             scratch_pool);
-
-  return SVN_NO_ERROR;
-}
-
-
-/* */
-static svn_wc_adm_access_t *
-get_from_shared(const char *abspath,
-                svn_wc__db_t *db,
-                apr_pool_t *scratch_pool)
-{
-  /* We closed the DB when it became empty. ABSPATH is not present.  */
-  if (db == NULL)
-    return NULL;
-  return svn_wc__db_temp_get_access(db, abspath, scratch_pool);
-}
-
-
-/* */
-static svn_error_t *
 probe(svn_wc__db_t *db,
       const char **dir,
       const char *path,
@@ -537,65 +580,6 @@ open_single(svn_wc_adm_access_t **adm_ac
 }
 
 
-/* */
-static svn_error_t *
-close_single(svn_wc_adm_access_t *adm_access,
-             svn_boolean_t preserve_lock,
-             apr_pool_t *scratch_pool)
-{
-  svn_boolean_t locked;
-
-  if (adm_access->closed)
-    return SVN_NO_ERROR;
-
-  /* Physically unlock if required */
-  SVN_ERR(svn_wc__db_wclock_owns_lock(&locked, adm_access->db,
-                                      adm_access->abspath, TRUE,
-                                      scratch_pool));
-  if (locked)
-    {
-      if (!preserve_lock)
-        {
-          /* Remove the physical lock in the admin directory for
-             PATH. It is acceptable for the administrative area to
-             have disappeared, such as when the directory is removed
-             from the working copy.  It is an error for the lock to
-             have disappeared if the administrative area still exists. */
-
-          svn_error_t *err = svn_wc__db_wclock_release(adm_access->db,
-                                                       adm_access->abspath,
-                                                       scratch_pool);
-          if (err)
-            {
-              if (svn_wc__adm_area_exists(adm_access->abspath, scratch_pool))
-                return err;
-              svn_error_clear(err);
-            }
-        }
-    }
-
-  /* Reset to prevent further use of the lock. */
-  adm_access->closed = TRUE;
-
-  /* Detach from set */
-  SVN_ERR(svn_wc__db_temp_close_access(adm_access->db, adm_access->abspath,
-                                       adm_access, scratch_pool));
-
-  /* Possibly close the underlying wc_db. */
-  if (!adm_access->db_provided)
-    {
-      apr_hash_t *opened = svn_wc__db_temp_get_all_access(adm_access->db,
-                                                          scratch_pool);
-      if (apr_hash_count(opened) == 0)
-        {
-          SVN_ERR(svn_wc__db_close(adm_access->db));
-          adm_access->db = NULL;
-        }
-    }
-
-  return SVN_NO_ERROR;
-}
-
 /* Retrieves the KIND of LOCAL_ABSPATH and whether its administrative data is
    available in the working copy.
 

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=1125429&r1=1125428&r2=1125429&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Fri May 20 15:28:06 2011
@@ -69,19 +69,6 @@ struct work_item_dispatch {
 };
 
 
-/* ### forward declaration for this. Temporary hack so that a work item
-   ### can be constructed within another handler and dispatched
-   ### immediately. in most normal cases, appending a work item to the
-   ### queue should be fine. but for now... not so much. */
-static svn_error_t *
-dispatch_work_item(svn_wc__db_t *db,
-                   const char *wri_abspath,
-                   const svn_skel_t *work_item,
-                   svn_cancel_func_t cancel_func,
-                   void *cancel_baton,
-                   apr_pool_t *scratch_pool);
-
-
 static svn_error_t *
 get_and_record_fileinfo(svn_wc__db_t *db,
                         const char *local_abspath,
@@ -208,10 +195,10 @@ remove_base_node(svn_wc__db_t *db,
   return SVN_NO_ERROR;
 }
 
+
 /* Process the OP_REMOVE_BASE work item WORK_ITEM.
  * See svn_wc__wq_build_remove_base() which generates this work item.
  * Implements (struct work_item_dispatch).func. */
-
 static svn_error_t *
 run_base_remove(svn_wc__db_t *db,
                 const svn_skel_t *work_item,
@@ -582,9 +569,10 @@ run_postupgrade(svn_wc__db_t *db,
                                    scratch_pool);
 
   /* Write the 'format' and 'entries' files.
+
      ### The order may matter for some sufficiently old clients.. but
-         this code only runs during upgrade after the files had been
-         removed earlier during the upgrade. */
+     ### this code only runs during upgrade after the files had been
+     ### removed earlier during the upgrade. */
   SVN_ERR(svn_io_write_unique(&temp_path, adm_path, SVN_WC__NON_ENTRIES_STRING,
                               sizeof(SVN_WC__NON_ENTRIES_STRING),
                               svn_io_file_del_none, scratch_pool));
@@ -1017,10 +1005,6 @@ svn_wc__wq_build_file_copy_translated(sv
                              svn_dirent_local_style(src_abspath,
                                                     scratch_pool));
 
-  /* ### Once we move to a central DB we should try making
-     ### src_abspath, dst_abspath and info_abspath relative from
-     ### the WCROOT of info_abspath. */
-
   SVN_ERR(svn_wc__db_to_relpath(&local_relpath, db, local_abspath, dst_abspath,
                                 result_pool, scratch_pool));
   svn_skel__prepend_str(local_relpath, *work_item, result_pool);