Author: stefan2
Date: Thu Feb 19 23:00:53 2015
New Revision: 1661031

URL: http://svn.apache.org/r1661031
Log:
On the fsx-1.10 branch:
Switch a first batch of DAG functions from returning an error code
to returning the requested information.

* subversion/libsvn_fs_x/dag.h
  (svn_fs_x__dag_get_node_id,
   svn_fs_x__dag_get_copy_id,
   svn_fs_x__dag_related_node,
   svn_fs_x__dag_same_line_of_history): Replace the error return with the
                                        former output value.

* subversion/libsvn_fs_x/dag.c
  (svn_fs_x__dag_get_node_id,
   svn_fs_x__dag_get_copy_id,
   svn_fs_x__dag_related_node,
   svn_fs_x__dag_same_line_of_history): Update implementation.

* subversion/libsvn_fs_x/dag_cache.c
  (get_copy_inheritance,
   svn_fs_x__make_path_mutable): Update / simplify callers.

* subversion/libsvn_fs_x/tree.c
  (x_node_relation,
   compare_dir_structure,
   merge,
   merge_changes,
   x_closest_copy,
   x_node_origin_rev): Same.

Modified:
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.h
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.c?rev=1661031&r1=1661030&r2=1661031&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.c Thu Feb 19 
23:00:53 2015
@@ -123,54 +123,35 @@ copy_node_revision(svn_fs_x__noderev_t *
 }
 
 
-/* Return the node revision ID of NODE.  The value returned is shared
-   with NODE, and will be deallocated when NODE is.  */
-svn_error_t *
-svn_fs_x__dag_get_node_id(svn_fs_x__id_t *node_id,
-                          dag_node_t *node)
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_node_id(dag_node_t *node)
 {
-  *node_id = node->node_revision->node_id;
-  return SVN_NO_ERROR;
+  return &node->node_revision->node_id;
 }
 
-/* Return the node revision ID of NODE.  The value returned is shared
-   with NODE, and will be deallocated when NODE is.  */
-svn_error_t *
-svn_fs_x__dag_get_copy_id(svn_fs_x__id_t *copy_id,
-                          dag_node_t *node)
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_copy_id(dag_node_t *node)
 {
-  *copy_id = node->node_revision->copy_id;
-  return SVN_NO_ERROR;
+  return &node->node_revision->copy_id;
 }
 
-/* Return the node ID of NODE.  The value returned is shared with NODE,
-   and will be deallocated when NODE is.  */
-svn_error_t *
-svn_fs_x__dag_related_node(svn_boolean_t *same,
-                           dag_node_t *lhs,
+svn_boolean_t
+svn_fs_x__dag_related_node(dag_node_t *lhs,
                            dag_node_t *rhs)
 {
-  svn_fs_x__id_t lhs_node, rhs_node;
-
-  SVN_ERR(svn_fs_x__dag_get_node_id(&lhs_node, lhs));
-  SVN_ERR(svn_fs_x__dag_get_node_id(&rhs_node, rhs));
-  *same = svn_fs_x__id_eq(&lhs_node, &rhs_node);
-
-  return SVN_NO_ERROR;
+  return svn_fs_x__id_eq(&lhs->node_revision->node_id,
+                         &rhs->node_revision->node_id);
 }
 
-svn_error_t *
-svn_fs_x__dag_same_line_of_history(svn_boolean_t *same,
-                                   dag_node_t *lhs,
+svn_boolean_t
+svn_fs_x__dag_same_line_of_history(dag_node_t *lhs,
                                    dag_node_t *rhs)
 {
   svn_fs_x__noderev_t *lhs_noderev = lhs->node_revision;
   svn_fs_x__noderev_t *rhs_noderev = rhs->node_revision;
 
-  *same = svn_fs_x__id_eq(&lhs_noderev->node_id, &rhs_noderev->node_id)
-       && svn_fs_x__id_eq(&lhs_noderev->copy_id, &rhs_noderev->copy_id);
-
-  return SVN_NO_ERROR;
+  return svn_fs_x__id_eq(&lhs_noderev->node_id, &rhs_noderev->node_id)
+      && svn_fs_x__id_eq(&lhs_noderev->copy_id, &rhs_noderev->copy_id);
 }
 
 svn_boolean_t

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.h?rev=1661031&r1=1661030&r2=1661031&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.h (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.h Thu Feb 19 
23:00:53 2015
@@ -112,27 +112,23 @@ svn_fs_x__dag_get_id(const dag_node_t *n
 
 /* Return the node ID of NODE.  The value returned is shared with NODE,
    and will be deallocated when NODE is.  */
-svn_error_t *
-svn_fs_x__dag_get_node_id(svn_fs_x__id_t *node_id,
-                          dag_node_t *node);
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_node_id(dag_node_t *node);
 
 /* Return the copy ID of NODE.  The value returned is shared with NODE,
    and will be deallocated when NODE is.  */
-svn_error_t *
-svn_fs_x__dag_get_copy_id(svn_fs_x__id_t *copy_id,
-                          dag_node_t *node);
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_copy_id(dag_node_t *node);
 
-/* Set *SAME to TRUE, if nodes LHS and RHS have the same node ID. */
-svn_error_t *
-svn_fs_x__dag_related_node(svn_boolean_t *same,
-                           dag_node_t *lhs,
+/* Return TRUE, iff nodes LHS and RHS have the same node ID. */
+svn_boolean_t
+svn_fs_x__dag_related_node(dag_node_t *lhs,
                            dag_node_t *rhs);
 
-/* Set *SAME to TRUE, if nodes LHS and RHS have the same node and copy IDs.
+/* Return TRUE, iff nodes LHS and RHS have the same node and copy IDs.
  */
-svn_error_t *
-svn_fs_x__dag_same_line_of_history(svn_boolean_t *same,
-                                   dag_node_t *lhs,
+svn_boolean_t
+svn_fs_x__dag_same_line_of_history(dag_node_t *lhs,
                                    dag_node_t *rhs);
 
 /* Return the created path of NODE.  The value returned is shared

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c?rev=1661031&r1=1661030&r2=1661031&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c Thu Feb 19 
23:00:53 2015
@@ -780,7 +780,6 @@ get_copy_inheritance(svn_fs_x__copy_id_i
                      apr_pool_t *pool)
 {
   svn_fs_x__id_t child_copy_id, parent_copy_id;
-  svn_boolean_t related;
   const char *id_path = NULL;
   svn_fs_root_t *copyroot_root;
   dag_node_t *copyroot_node;
@@ -790,8 +789,8 @@ get_copy_inheritance(svn_fs_x__copy_id_i
   SVN_ERR_ASSERT(child && child->parent);
 
   /* Initialize some convenience variables. */
-  SVN_ERR(svn_fs_x__dag_get_copy_id(&child_copy_id, child->node));
-  SVN_ERR(svn_fs_x__dag_get_copy_id(&parent_copy_id, child->parent->node));
+  child_copy_id = *svn_fs_x__dag_get_copy_id(child->node);
+  parent_copy_id = *svn_fs_x__dag_get_copy_id(child->parent->node);
 
   /* If this child is already mutable, we have nothing to do. */
   if (svn_fs_x__dag_check_mutable(child->node))
@@ -831,8 +830,7 @@ get_copy_inheritance(svn_fs_x__copy_id_i
   SVN_ERR(svn_fs_x__get_dag_node(&copyroot_node, copyroot_root,
                                  copyroot_path, pool));
 
-  SVN_ERR(svn_fs_x__dag_related_node(&related, copyroot_node, child->node));
-  if (!related)
+  if (svn_fs_x__dag_related_node(copyroot_node, child->node))
     return SVN_NO_ERROR;
 
   /* Determine if we are looking at the child via its original path or
@@ -1041,7 +1039,6 @@ svn_fs_x__make_path_mutable(svn_fs_root_
       svn_boolean_t is_parent_copyroot = FALSE;
       svn_fs_root_t *copyroot_root;
       dag_node_t *copyroot_node;
-      svn_boolean_t related;
       apr_pool_t *subpool;
 
       /* We're trying to clone somebody's child.  Make sure our parent
@@ -1057,8 +1054,7 @@ svn_fs_x__make_path_mutable(svn_fs_root_
       switch (inherit)
         {
         case svn_fs_x__copy_id_inherit_parent:
-          SVN_ERR(svn_fs_x__dag_get_copy_id(&copy_id,
-                                            parent_path->parent->node));
+          copy_id = *svn_fs_x__dag_get_copy_id(parent_path->parent->node);
           break;
 
         case svn_fs_x__copy_id_inherit_new:
@@ -1084,9 +1080,7 @@ svn_fs_x__make_path_mutable(svn_fs_root_
       SVN_ERR(svn_fs_x__get_dag_node(&copyroot_node, copyroot_root,
                                      copyroot_path, result_pool));
 
-      SVN_ERR(svn_fs_x__dag_related_node(&related, copyroot_node,
-                                         parent_path->node));
-      if (!related)
+      if (svn_fs_x__dag_related_node(copyroot_node, parent_path->node))
         is_parent_copyroot = TRUE;
 
       /* Now make this node mutable.  */

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c?rev=1661031&r1=1661030&r2=1661031&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c Thu Feb 19 
23:00:53 2015
@@ -353,11 +353,11 @@ x_node_relation(svn_fs_node_relation_t *
    * Now, we can simply test for the ID values themselves. */
   SVN_ERR(svn_fs_x__get_dag_node(&node, root_a, path_a, scratch_pool));
   noderev_id_a = *svn_fs_x__dag_get_id(node);
-  SVN_ERR(svn_fs_x__dag_get_node_id(&node_id_a, node));
+  node_id_a = *svn_fs_x__dag_get_node_id(node);
 
   SVN_ERR(svn_fs_x__get_dag_node(&node, root_b, path_b, scratch_pool));
   noderev_id_b = *svn_fs_x__dag_get_id(node);
-  SVN_ERR(svn_fs_x__dag_get_node_id(&node_id_b, node));
+  node_id_b = *svn_fs_x__dag_get_node_id(node);
 
   if (svn_fs_x__id_eq(&noderev_id_a, &noderev_id_b))
     *relation = svn_fs_node_same;
@@ -680,7 +680,6 @@ compare_dir_structure(svn_boolean_t *cha
 
       if (strcmp(lhs_entry->name, rhs_entry->name) == 0)
         {
-          svn_boolean_t same_history;
           dag_node_t *lhs_node, *rhs_node;
 
           /* Unchanged entry? */
@@ -695,9 +694,7 @@ compare_dir_structure(svn_boolean_t *cha
                                          iterpool, iterpool));
           SVN_ERR(svn_fs_x__dag_get_node(&rhs_node, fs, &rhs_entry->id, 
                                          iterpool, iterpool));
-          SVN_ERR(svn_fs_x__dag_same_line_of_history(&same_history,
-                                                     lhs_node, rhs_node));
-          if (same_history)
+          if (svn_fs_x__dag_same_line_of_history(lhs_node, rhs_node))
             continue;
         }
 
@@ -979,7 +976,6 @@ merge(svn_stringbuf_t *conflict_p,
           dag_node_t *s_ent_node, *t_ent_node, *a_ent_node;
           const char *new_tpath;
           apr_int64_t sub_mergeinfo_increment;
-          svn_boolean_t s_a_same, t_a_same;
 
           /* If SOURCE-ENTRY and TARGET-ENTRY are both null, that's a
              double delete; if one of them is null, that's a delete versus
@@ -1009,11 +1005,8 @@ merge(svn_stringbuf_t *conflict_p,
 
           /* If either SOURCE-ENTRY or TARGET-ENTRY is not a direct
              modification of ANCESTOR-ENTRY, declare a conflict. */
-          SVN_ERR(svn_fs_x__dag_same_line_of_history(&s_a_same, s_ent_node,
-                                                     a_ent_node));
-          SVN_ERR(svn_fs_x__dag_same_line_of_history(&t_a_same, t_ent_node,
-                                                     a_ent_node));
-          if (!s_a_same || !t_a_same)
+          if (   !svn_fs_x__dag_same_line_of_history(s_ent_node, a_ent_node)
+              || !svn_fs_x__dag_same_line_of_history(t_ent_node, a_ent_node))
             return conflict_err(conflict_p,
                                 svn_fspath__join(target_path,
                                                  a_entry->name,
@@ -1099,8 +1092,7 @@ merge_changes(dag_node_t *ancestor_node,
   dag_node_t *txn_root_node;
   svn_fs_t *fs = txn->fs;
   svn_fs_x__txn_id_t txn_id = svn_fs_x__txn_get_id(txn);
-  svn_boolean_t related;
-  
+
   SVN_ERR(svn_fs_x__dag_txn_root(&txn_root_node, fs, txn_id, scratch_pool,
                                  scratch_pool));
 
@@ -1112,8 +1104,7 @@ merge_changes(dag_node_t *ancestor_node,
                                           scratch_pool, scratch_pool));
     }
 
-  SVN_ERR(svn_fs_x__dag_related_node(&related, ancestor_node, txn_root_node));
-  if (!related)
+  if (svn_fs_x__dag_related_node(ancestor_node, txn_root_node))
     {
       /* If no changes have been made in TXN since its current base,
          then it can't conflict with any changes since that base.
@@ -2454,7 +2445,6 @@ x_closest_copy(svn_fs_root_t **root_p,
   const char *copy_dst_path;
   svn_fs_root_t *copy_dst_root;
   dag_node_t *copy_dst_node;
-  svn_boolean_t related;
   apr_pool_t *scratch_pool = svn_pool_create(pool);
 
   /* Initialize return values. */
@@ -2490,9 +2480,7 @@ x_closest_copy(svn_fs_root_t **root_p,
     }
 
   copy_dst_node = copy_dst_dag_path->node;
-  SVN_ERR(svn_fs_x__dag_related_node(&related, copy_dst_node,
-                                     dag_path->node));
-  if (!related)
+  if (!svn_fs_x__dag_related_node(copy_dst_node, dag_path->node))
     {
       svn_pool_destroy(scratch_pool);
       return SVN_NO_ERROR;
@@ -2545,7 +2533,7 @@ x_node_origin_rev(svn_revnum_t *revision
   path = svn_fs__canonicalize_abspath(path, scratch_pool);
 
   SVN_ERR(svn_fs_x__get_dag_node(&node, root, path, scratch_pool));
-  SVN_ERR(svn_fs_x__dag_get_node_id(&node_id, node));
+  node_id = *svn_fs_x__dag_get_node_id(node);
 
   *revision = svn_fs_x__get_revnum(node_id.change_set);
 


Reply via email to