You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/04/26 22:24:07 UTC

svn commit: r1331065 - in /subversion/trunk/subversion: include/private/svn_fs_util.h libsvn_fs_base/bdb/lock-tokens-table.c libsvn_fs_base/bdb/locks-table.c libsvn_fs_base/lock.c libsvn_fs_base/tree.c libsvn_fs_fs/lock.c libsvn_fs_fs/tree.c

Author: danielsh
Date: Thu Apr 26 20:24:07 2012
New Revision: 1331065

URL: http://svn.apache.org/viewvc?rev=1331065&view=rev
Log:
Follow-up to r1331055: simplify FS-private macros.

* subversion/include/private/svn_fs_util.h
  (svn_fs__identifier): Remove the POOL argument.  (This macro will stay,
    contrary to the log message of r1331055; however, it is only used currently
    by this header itself.))
  (SVN_FS__ALREADY_EXISTS, SVN_FS__ERR_NOT_MUTABLE, 
   SVN_FS__ERR_NOT_DIRECTORY, SVN_FS__ERR_NOT_FILE,
   SVN_FS__ERR_PATH_ALREADY_LOCKED, SVN_FS__ERR_NO_SUCH_LOCK,
   SVN_FS__ERR_LOCK_EXPIRED, SVN_FS__ERR_NO_USER,
   SVN_FS__ERR_LOCK_OWNER_MISMATCH):
    Update calls to svn_fs__identifier(), and remove POOL arguments.

* subversion/libsvn_fs_fs/tree.c,
  subversion/libsvn_fs_fs/lock.c,
  subversion/libsvn_fs_base/tree.c,
  subversion/libsvn_fs_base/bdb/lock-tokens-table.c,
  subversion/libsvn_fs_base/bdb/locks-table.c,
  subversion/libsvn_fs_base/lock.c:
  (*): Remove POOL arguments in calls to the SVN_FS__ERR_*() macros.

Modified:
    subversion/trunk/subversion/include/private/svn_fs_util.h
    subversion/trunk/subversion/libsvn_fs_base/bdb/lock-tokens-table.c
    subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c
    subversion/trunk/subversion/libsvn_fs_base/lock.c
    subversion/trunk/subversion/libsvn_fs_base/tree.c
    subversion/trunk/subversion/libsvn_fs_fs/lock.c
    subversion/trunk/subversion/libsvn_fs_fs/tree.c

Modified: subversion/trunk/subversion/include/private/svn_fs_util.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_fs_util.h?rev=1331065&r1=1331064&r2=1331065&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_fs_util.h (original)
+++ subversion/trunk/subversion/include/private/svn_fs_util.h Thu Apr 26 20:24:07 2012
@@ -59,8 +59,9 @@ svn_fs__canonicalize_abspath(const char 
 svn_error_t *
 svn_fs__check_fs(svn_fs_t *fs, svn_boolean_t expect_open);
 
-/** Temporary, to be removed in the next revision. */
-#define svn_fs__identifier(fs, unused) ((fs)->uuid)
+/* An identifier for FS to be used in the text of error messages.
+   (Not used anywhere but in this header.) */
+#define svn_fs__identifier(fs) ((fs)->uuid)
 
 /* Constructing nice error messages for roots.  */
 
@@ -82,17 +83,17 @@ svn_fs__check_fs(svn_fs_t *fs, svn_boole
 
 /* Build a detailed `file already exists' message for PATH in ROOT.
    ROOT is of type svn_fs_root_t *. */
-#define SVN_FS__ALREADY_EXISTS(root, path_str, pool) (                         \
+#define SVN_FS__ALREADY_EXISTS(root, path_str) (                               \
   root->is_txn_root ?                                                          \
     svn_error_createf                                                          \
       (SVN_ERR_FS_ALREADY_EXISTS, 0,                                           \
        _("File already exists: filesystem '%s', transaction '%s', path '%s'"), \
-       svn_fs__identifier(root->fs, pool), root->txn, path_str)      \
+       svn_fs__identifier(root->fs), root->txn, path_str)      \
   :                                                                            \
     svn_error_createf                                                          \
       (SVN_ERR_FS_ALREADY_EXISTS, 0,                                           \
        _("File already exists: filesystem '%s', revision %ld, path '%s'"),     \
-       svn_fs__identifier(root->fs, pool), root->rev, path_str)      \
+       svn_fs__identifier(root->fs), root->rev, path_str)      \
   )
 
 /* ROOT is of type svn_fs_root_t *. */
@@ -103,64 +104,64 @@ svn_fs__check_fs(svn_fs_t *fs, svn_boole
 
 /* SVN_FS__ERR_NOT_MUTABLE: the caller attempted to change a node
    outside of a transaction. FS is of type "svn_fs_t *". */
-#define SVN_FS__ERR_NOT_MUTABLE(fs, rev, path_in_repo, scratch_pool)     \
+#define SVN_FS__ERR_NOT_MUTABLE(fs, rev, path_in_repo)                   \
   svn_error_createf(                                                     \
      SVN_ERR_FS_NOT_MUTABLE, 0,                                          \
      _("File is not mutable: filesystem '%s', revision %ld, path '%s'"), \
-     svn_fs__identifier(fs, scratch_pool), rev, path_in_repo)
+     svn_fs__identifier(fs), rev, path_in_repo)
 
 /* FS is of type "svn_fs_t *".*/
-#define SVN_FS__ERR_NOT_DIRECTORY(fs, path_in_repo, scratch_pool) \
+#define SVN_FS__ERR_NOT_DIRECTORY(fs, path_in_repo)               \
   svn_error_createf(                                              \
      SVN_ERR_FS_NOT_DIRECTORY, 0,                                 \
      _("'%s' is not a directory in filesystem '%s'"),             \
-     path_in_repo, svn_fs__identifier(fs, scratch_pool))
+     path_in_repo, svn_fs__identifier(fs))
 
 /* FS is of type "svn_fs_t *".   */
-#define SVN_FS__ERR_NOT_FILE(fs, path_in_repo, scratch_pool)      \
+#define SVN_FS__ERR_NOT_FILE(fs, path_in_repo)                    \
   svn_error_createf(                                              \
      SVN_ERR_FS_NOT_FILE, 0,                                      \
      _("'%s' is not a file in filesystem '%s'"),                  \
-     path_in_repo, svn_fs__identifier(fs, scratch_pool))
+     path_in_repo, svn_fs__identifier(fs))
 
 
 /* FS is of type "svn_fs_t *", LOCK is of type "svn_lock_t *".   */
-#define SVN_FS__ERR_PATH_ALREADY_LOCKED(fs, lock, scratch_pool)             \
+#define SVN_FS__ERR_PATH_ALREADY_LOCKED(fs, lock)                           \
   svn_error_createf(                                                        \
      SVN_ERR_FS_PATH_ALREADY_LOCKED, 0,                                     \
      _("Path '%s' is already locked by user '%s' in filesystem '%s'"),      \
-     lock->path, lock->owner, svn_fs__identifier(fs, scratch_pool))
+     (lock)->path, (lock)->owner, svn_fs__identifier(fs))
 
 /* FS is of type "svn_fs_t *". */
-#define SVN_FS__ERR_NO_SUCH_LOCK(fs, path_in_repo, scratch_pool)  \
+#define SVN_FS__ERR_NO_SUCH_LOCK(fs, path_in_repo)                \
   svn_error_createf(                                              \
      SVN_ERR_FS_NO_SUCH_LOCK, 0,                                  \
      _("No lock on path '%s' in filesystem '%s'"),                \
-     path_in_repo, svn_fs__identifier(fs, scratch_pool))
+     path_in_repo, svn_fs__identifier(fs))
 
 /* FS is of type "svn_fs_t *". */
-#define SVN_FS__ERR_LOCK_EXPIRED(fs, token, scratch_pool)        \
+#define SVN_FS__ERR_LOCK_EXPIRED(fs, token)                      \
   svn_error_createf(                                             \
      SVN_ERR_FS_LOCK_EXPIRED, 0,                                 \
      _("Lock has expired: lock-token '%s' in filesystem '%s'"),  \
-     token, svn_fs__identifier(fs, scratch_pool))
+     token, svn_fs__identifier(fs))
 
 /* FS is of type "svn_fs_t *". */
-#define SVN_FS__ERR_NO_USER(fs, scratch_pool)                       \
+#define SVN_FS__ERR_NO_USER(fs)                                     \
   svn_error_createf(                                                \
      SVN_ERR_FS_NO_USER, 0,                                         \
      _("No username is currently associated with filesystem '%s'"), \
-     svn_fs__identifier(fs, scratch_pool))
+     svn_fs__identifier(fs))
 
 /* SVN_FS__ERR_LOCK_OWNER_MISMATCH: trying to use a lock whose
    LOCK_OWNER doesn't match the USERNAME associated with FS.
    FS is of type "svn_fs_t *". */
-#define SVN_FS__ERR_LOCK_OWNER_MISMATCH(fs, username, lock_owner, pool) \
+#define SVN_FS__ERR_LOCK_OWNER_MISMATCH(fs, username, lock_owner)       \
   svn_error_createf(                                                    \
      SVN_ERR_FS_LOCK_OWNER_MISMATCH, 0,                                 \
      _("User '%s' is trying to use a lock owned by '%s' in "            \
        "filesystem '%s'"),                                              \
-     username, lock_owner, svn_fs__identifier(fs, pool))
+     username, lock_owner, svn_fs__identifier(fs))
 
 /* Return a NULL-terminated copy of the first component of PATH,
    allocated in POOL.  If path is empty, or consists entirely of

Modified: subversion/trunk/subversion/libsvn_fs_base/bdb/lock-tokens-table.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/bdb/lock-tokens-table.c?rev=1331065&r1=1331064&r2=1331065&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/bdb/lock-tokens-table.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/bdb/lock-tokens-table.c Thu Apr 26 20:24:07 2012
@@ -104,7 +104,7 @@ svn_fs_bdb__lock_token_delete(svn_fs_t *
   svn_fs_base__trail_debug(trail, "lock-tokens", "del");
   db_err = bfd->lock_tokens->del(bfd->lock_tokens, trail->db_txn, &key, 0);
   if (db_err == DB_NOTFOUND)
-    return SVN_FS__ERR_NO_SUCH_LOCK(fs, path, pool);
+    return SVN_FS__ERR_NO_SUCH_LOCK(fs, path);
   return BDB_WRAP(fs, "deleting entry from 'lock-tokens' table", db_err);
 }
 
@@ -131,7 +131,7 @@ svn_fs_bdb__lock_token_get(const char **
   svn_fs_base__track_dbt(&value, pool);
 
   if (db_err == DB_NOTFOUND)
-    return SVN_FS__ERR_NO_SUCH_LOCK(fs, path, pool);
+    return SVN_FS__ERR_NO_SUCH_LOCK(fs, path);
   SVN_ERR(BDB_WRAP(fs, "reading lock token", db_err));
 
   lock_token = apr_pstrmemdup(pool, value.data, value.size);

Modified: subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c?rev=1331065&r1=1331064&r2=1331065&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/bdb/locks-table.c Thu Apr 26 20:24:07 2012
@@ -153,7 +153,7 @@ svn_fs_bdb__lock_get(svn_lock_t **lock_p
   if (lock->expiration_date && (apr_time_now() > lock->expiration_date))
     {
       SVN_ERR(svn_fs_bdb__lock_delete(fs, lock_token, trail, pool));
-      return SVN_FS__ERR_LOCK_EXPIRED(fs, lock_token, pool);
+      return SVN_FS__ERR_LOCK_EXPIRED(fs, lock_token);
     }
 
   *lock_p = lock;

Modified: subversion/trunk/subversion/libsvn_fs_base/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/lock.c?rev=1331065&r1=1331064&r2=1331065&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/lock.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/lock.c Thu Apr 26 20:24:07 2012
@@ -93,7 +93,7 @@ txn_body_lock(void *baton, trail_t *trai
   /* Until we implement directory locks someday, we only allow locks
      on files or non-existent paths. */
   if (kind == svn_node_dir)
-    return SVN_FS__ERR_NOT_FILE(trail->fs, args->path, trail->pool);
+    return SVN_FS__ERR_NOT_FILE(trail->fs, args->path);
 
   /* While our locking implementation easily supports the locking of
      nonexistent paths, we deliberately choose not to allow such madness. */
@@ -113,7 +113,7 @@ txn_body_lock(void *baton, trail_t *trai
 
   /* There better be a username attached to the fs. */
   if (!trail->fs->access_ctx || !trail->fs->access_ctx->username)
-    return SVN_FS__ERR_NO_USER(trail->fs, trail->pool);
+    return SVN_FS__ERR_NO_USER(trail->fs);
 
   /* Is the caller attempting to lock an out-of-date working file? */
   if (SVN_IS_VALID_REVNUM(args->current_rev))
@@ -179,8 +179,7 @@ txn_body_lock(void *baton, trail_t *trai
         {
           /* Sorry, the path is already locked. */
           return SVN_FS__ERR_PATH_ALREADY_LOCKED(trail->fs,
-                                                 existing_lock,
-                                                 trail->pool);
+                                                 existing_lock);
         }
       else
         {
@@ -282,22 +281,21 @@ txn_body_unlock(void *baton, trail_t *tr
       if (args->token == NULL)
         return svn_fs_base__err_no_lock_token(trail->fs, args->path);
       else if (strcmp(lock_token, args->token) != 0)
-        return SVN_FS__ERR_NO_SUCH_LOCK(trail->fs, args->path, trail->pool);
+        return SVN_FS__ERR_NO_SUCH_LOCK(trail->fs, args->path);
 
       SVN_ERR(svn_fs_bdb__lock_get(&lock, trail->fs, lock_token,
                                    trail, trail->pool));
 
       /* There better be a username attached to the fs. */
       if (!trail->fs->access_ctx || !trail->fs->access_ctx->username)
-        return SVN_FS__ERR_NO_USER(trail->fs, trail->pool);
+        return SVN_FS__ERR_NO_USER(trail->fs);
 
       /* And that username better be the same as the lock's owner. */
       if (strcmp(trail->fs->access_ctx->username, lock->owner) != 0)
         return SVN_FS__ERR_LOCK_OWNER_MISMATCH(
            trail->fs,
            trail->fs->access_ctx->username,
-           lock->owner,
-           trail->pool);
+           lock->owner);
     }
 
   /* Remove a row from each of the locking tables. */

Modified: subversion/trunk/subversion/libsvn_fs_base/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/tree.c?rev=1331065&r1=1331064&r2=1331065&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/tree.c Thu Apr 26 20:24:07 2012
@@ -431,7 +431,7 @@ mutable_root_node(dag_node_t **node_p,
                                        trail, pool);
   else
     /* If it's not a transaction root, we can't change its contents.  */
-    return SVN_FS__ERR_NOT_MUTABLE(root->fs, root->rev, error_path, pool);
+    return SVN_FS__ERR_NOT_MUTABLE(root->fs, root->rev, error_path);
 }
 
 
@@ -769,7 +769,7 @@ open_path(parent_path_t **parent_path_p,
 
       /* The path isn't finished yet; we'd better be in a directory.  */
       if (svn_fs_base__dag_node_kind(child) != svn_node_dir)
-        SVN_ERR_W(SVN_FS__ERR_NOT_DIRECTORY(fs, path_so_far, pool),
+        SVN_ERR_W(SVN_FS__ERR_NOT_DIRECTORY(fs, path_so_far),
                   apr_psprintf(pool, _("Failure opening '%s'"), path));
 
       rest = next;
@@ -2926,7 +2926,7 @@ txn_body_make_dir(void *baton,
   /* If there's already a sub-directory by that name, complain.  This
      also catches the case of trying to make a subdirectory named `/'.  */
   if (parent_path->node)
-    return SVN_FS__ALREADY_EXISTS(root, path, trail->pool);
+    return SVN_FS__ALREADY_EXISTS(root, path);
 
   /* Check to see if some lock is 'reserving' a file-path or dir-path
      at that location, or even some child-path;  if so, check that we
@@ -3369,7 +3369,7 @@ txn_body_make_file(void *baton,
   /* If there's already a file by that name, complain.
      This also catches the case of trying to make a file named `/'.  */
   if (parent_path->node)
-    return SVN_FS__ALREADY_EXISTS(root, path, trail->pool);
+    return SVN_FS__ALREADY_EXISTS(root, path);
 
   /* Check to see if some lock is 'reserving' a file-path or dir-path
      at that location, or even some child-path;  if so, check that we

Modified: subversion/trunk/subversion/libsvn_fs_fs/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/lock.c?rev=1331065&r1=1331064&r2=1331065&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/lock.c Thu Apr 26 20:24:07 2012
@@ -493,7 +493,7 @@ get_lock(svn_lock_t **lock_p,
 
   SVN_ERR(read_digest_file(NULL, &lock, fs->path, digest_path, pool));
   if (! lock)
-    return SVN_FS__ERR_NO_SUCH_LOCK(fs, path, pool);
+    return SVN_FS__ERR_NO_SUCH_LOCK(fs, path);
 
   /* Don't return an expired lock. */
   if (lock->expiration_date && (apr_time_now() > lock->expiration_date))
@@ -503,7 +503,7 @@ get_lock(svn_lock_t **lock_p,
       if (have_write_lock)
         SVN_ERR(delete_lock(fs, lock, pool));
       *lock_p = NULL;
-      return SVN_FS__ERR_LOCK_EXPIRED(fs, lock->token, pool);
+      return SVN_FS__ERR_LOCK_EXPIRED(fs, lock->token);
     }
 
   *lock_p = lock;
@@ -766,7 +766,7 @@ lock_body(void *baton, apr_pool_t *pool)
   SVN_ERR(lb->fs->vtable->revision_root(&root, lb->fs, youngest, pool));
   SVN_ERR(svn_fs_fs__check_path(&kind, root, lb->path, pool));
   if (kind == svn_node_dir)
-    return SVN_FS__ERR_NOT_FILE(lb->fs, lb->path, pool);
+    return SVN_FS__ERR_NOT_FILE(lb->fs, lb->path);
 
   /* While our locking implementation easily supports the locking of
      nonexistent paths, we deliberately choose not to allow such madness. */
@@ -786,7 +786,7 @@ lock_body(void *baton, apr_pool_t *pool)
 
   /* We need to have a username attached to the fs. */
   if (!lb->fs->access_ctx || !lb->fs->access_ctx->username)
-    return SVN_FS__ERR_NO_USER(lb->fs, pool);
+    return SVN_FS__ERR_NO_USER(lb->fs);
 
   /* Is the caller attempting to lock an out-of-date working file? */
   if (SVN_IS_VALID_REVNUM(lb->current_rev))
@@ -832,7 +832,7 @@ lock_body(void *baton, apr_pool_t *pool)
       if (! lb->steal_lock)
         {
           /* Sorry, the path is already locked. */
-          return SVN_FS__ERR_PATH_ALREADY_LOCKED(lb->fs, existing_lock, pool);
+          return SVN_FS__ERR_PATH_ALREADY_LOCKED(lb->fs, existing_lock);
         }
       else
         {
@@ -888,16 +888,16 @@ unlock_body(void *baton, apr_pool_t *poo
     {
       /* Sanity check:  the incoming token should match lock->token. */
       if (strcmp(ub->token, lock->token) != 0)
-        return SVN_FS__ERR_NO_SUCH_LOCK(ub->fs, lock->path, pool);
+        return SVN_FS__ERR_NO_SUCH_LOCK(ub->fs, lock->path);
 
       /* There better be a username attached to the fs. */
       if (! (ub->fs->access_ctx && ub->fs->access_ctx->username))
-        return SVN_FS__ERR_NO_USER(ub->fs, pool);
+        return SVN_FS__ERR_NO_USER(ub->fs);
 
       /* And that username better be the same as the lock's owner. */
       if (strcmp(ub->fs->access_ctx->username, lock->owner) != 0)
         return SVN_FS__ERR_LOCK_OWNER_MISMATCH(
-           ub->fs, ub->fs->access_ctx->username, lock->owner, pool);
+           ub->fs, ub->fs->access_ctx->username, lock->owner);
     }
 
   /* Remove lock and lock token files. */

Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1331065&r1=1331064&r2=1331065&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Thu Apr 26 20:24:07 2012
@@ -359,7 +359,7 @@ mutable_root_node(dag_node_t **node_p,
     return svn_fs_fs__dag_clone_root(node_p, root->fs, root->txn, pool);
   else
     /* If it's not a transaction root, we can't change its contents.  */
-    return SVN_FS__ERR_NOT_MUTABLE(root->fs, root->rev, error_path, pool);
+    return SVN_FS__ERR_NOT_MUTABLE(root->fs, root->rev, error_path);
 }
 
 
@@ -696,7 +696,7 @@ open_path(parent_path_t **parent_path_p,
 
       /* The path isn't finished yet; we'd better be in a directory.  */
       if (svn_fs_fs__dag_node_kind(child) != svn_node_dir)
-        SVN_ERR_W(SVN_FS__ERR_NOT_DIRECTORY(fs, path_so_far, iterpool),
+        SVN_ERR_W(SVN_FS__ERR_NOT_DIRECTORY(fs, path_so_far),
                   apr_psprintf(iterpool, _("Failure opening '%s'"), path));
 
       rest = next;
@@ -1837,7 +1837,7 @@ fs_make_dir(svn_fs_root_t *root,
   /* If there's already a sub-directory by that name, complain.  This
      also catches the case of trying to make a subdirectory named `/'.  */
   if (parent_path->node)
-    return SVN_FS__ALREADY_EXISTS(root, path, pool);
+    return SVN_FS__ALREADY_EXISTS(root, path);
 
   /* Create the subdirectory.  */
   SVN_ERR(make_path_mutable(root, parent_path->parent, path, pool));
@@ -2172,7 +2172,7 @@ fs_make_file(svn_fs_root_t *root,
   /* If there's already a file by that name, complain.
      This also catches the case of trying to make a file named `/'.  */
   if (parent_path->node)
-    return SVN_FS__ALREADY_EXISTS(root, path, pool);
+    return SVN_FS__ALREADY_EXISTS(root, path);
 
   /* Check (non-recursively) to see if path is locked;  if so, check
      that we can use it. */