[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Remove dead code from libsvn_fs_fs.

From: Malcolm Rowe <malcolm-svn-dev_at_farside.org.uk>
Date: 2005-12-01 16:43:41 CET

Anybody have any comments (or objections) about the attached patch?

[[[
Remove dead code from libsvn_fs_fs.

* subversion/libsvn_fs_fs/dag.c
  (svn_fs_fs__dag_walk_predecessors, struct is_ancestor_baton,
   is_ancestor_callback, svn_fs_fs__dag_is_ancestor,
   svn_fs_fs__dag_is_parent): Remove unused private functions and structures.

* subversion/libsvn_fs_fs/dag.h
  (dag_pred_func_t, svn_fs_fs__dag_walk_predecessors,
   svn_fs_fs__dag_is_ancestor, svn_fs_fs__dag_is_parent): Remove declarations.
]]]

Regards,
Malcolm

Index: dag.h
===================================================================
--- dag.h (revision 17585)
+++ dag.h (working copy)
@@ -118,26 +118,6 @@
                                                    apr_pool_t *pool);
 
 
-/* Callback function type for svn_fs_fs__dag_walk_predecessors() */
-typedef svn_error_t *(*dag_pred_func_t) (void *baton,
- dag_node_t *node,
- svn_boolean_t *done,
- apr_pool_t *pool);
-
-/* Walk over NODE's predecessor list, calling CALLBACK (with its
- associated BATON) for each predecessor until the callback returns
- an error (in which case, return that error) or until it sets its
- DONE flag. When the predecessor walk reaches a node with no
- predecessor, it will call the CALLBACK one final time with a NULL
- `node' argument to indicate that the predecessor walk is now
- complete.
-
- Do all allocations in POOL. */
-svn_error_t *svn_fs_fs__dag_walk_predecessors (dag_node_t *node,
- dag_pred_func_t callback,
- void *baton,
- apr_pool_t *pool);
-
 /* Return non-zero IFF NODE is currently mutable under Subversion
    transaction TXN_ID. */
 svn_boolean_t svn_fs_fs__dag_check_mutable (dag_node_t *node,
@@ -455,21 +435,6 @@
                                           apr_pool_t *pool);
 
 
-/* Set *IS_ANCESTOR to non-zero IFF NODE1 is an ancestor of NODE2.
- Get any temporary allocations from POOL. */
-svn_error_t *svn_fs_fs__dag_is_ancestor (svn_boolean_t *is_ancestor,
- dag_node_t *node1,
- dag_node_t *node2,
- apr_pool_t *pool);
-
-
-/* Set *IS_PARENT to non-zero IFF NODE1 is the parent of NODE2.
- Get any temporary allocations from POOL. */
-svn_error_t *svn_fs_fs__dag_is_parent (svn_boolean_t *is_ancestor,
- dag_node_t *node1,
- dag_node_t *node2,
- apr_pool_t *pool);
-
 /* Set *NODE_ID to the node-id of the coyproot of node NODE, or NULL
    if no copyroot exists. Get any temporary allocations from POOL. */
 svn_error_t *svn_fs_fs__dag_get_copyroot (svn_revnum_t *rev,
Index: dag.c
===================================================================
--- dag.c (revision 17585)
+++ dag.c (working copy)
@@ -232,56 +232,6 @@
 
 
 svn_error_t *
-svn_fs_fs__dag_walk_predecessors (dag_node_t *node,
- dag_pred_func_t callback,
- void *baton,
- apr_pool_t *pool)
-{
- svn_fs_t *fs = svn_fs_fs__dag_get_fs (node);
- dag_node_t *this_node;
- svn_boolean_t done = FALSE;
- apr_pool_t *last_iterpool, *iterpool, *tmp_iterpool;
-
- last_iterpool = svn_pool_create (pool);
- iterpool = svn_pool_create (pool);
- this_node = node;
- while ((! done) && this_node)
- {
- node_revision_t *noderev;
-
- /* Cycle the pools so iterpool will remain valid on the next
- * iteration. */
- tmp_iterpool = last_iterpool;
- last_iterpool = iterpool;
- iterpool = tmp_iterpool;
- svn_pool_clear (iterpool);
-
- /* Get the node revision for THIS_NODE so we can examine its
- predecessor id. */
- SVN_ERR (get_node_revision (&noderev, this_node, iterpool));
-
- /* If THIS_NODE has a predecessor, replace THIS_NODE with the
- precessor, else set it to NULL. */
- if (noderev->predecessor_id)
- SVN_ERR (svn_fs_fs__dag_get_node (&this_node, fs,
- noderev->predecessor_id,
- iterpool));
- else
- this_node = NULL;
-
- /* Now call the user-supplied callback with our predecessor
- node. */
- if (callback)
- SVN_ERR (callback (baton, this_node, &done, iterpool));
- }
- svn_pool_destroy (iterpool);
- svn_pool_destroy (last_iterpool);
-
- return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
 svn_fs_fs__dag_init_fs (svn_fs_t *fs)
 {
   apr_hash_t *proplist;
@@ -1098,104 +1048,7 @@
   return SVN_NO_ERROR;
 }
 
-
-
-struct is_ancestor_baton
-{
- const svn_fs_id_t *node1_id;
- svn_boolean_t is_ancestor;
- svn_boolean_t need_parent; /* TRUE if we only care about parenthood, not
- full ancestry */
-};
-
-
-static svn_error_t *
-is_ancestor_callback (void *baton,
- dag_node_t *node,
- svn_boolean_t *done,
- apr_pool_t *pool)
-{
- struct is_ancestor_baton *b = baton;
-
- /* If there is no NODE, then this is the last call, and we didn't
- find an ancestor. But if there is ... */
- if (node)
- {
- /* ... compare NODE's ID with the ID we're looking for. */
- if (svn_fs_fs__id_eq (b->node1_id, svn_fs_fs__dag_get_id (node)))
- b->is_ancestor = TRUE;
-
- /* Now, if we only are interested in parenthood, we don't care
- to look any further than this. */
- if (b->need_parent)
- *done = TRUE;
- }
-
- return SVN_NO_ERROR;
-}
-
 svn_error_t *
-svn_fs_fs__dag_is_ancestor (svn_boolean_t *is_ancestor,
- dag_node_t *node1,
- dag_node_t *node2,
- apr_pool_t *pool)
-{
- struct is_ancestor_baton baton;
- const svn_fs_id_t
- *id1 = svn_fs_fs__dag_get_id (node1),
- *id2 = svn_fs_fs__dag_get_id (node2);
-
- /* Pessimism. */
- *is_ancestor = FALSE;
-
- /* Ancestry holds relatedness as a prerequisite. */
- if (! svn_fs_fs__id_check_related (id1, id2))
- return SVN_NO_ERROR;
-
- baton.is_ancestor = FALSE;
- baton.need_parent = FALSE;
- baton.node1_id = id1;
-
- SVN_ERR (svn_fs_fs__dag_walk_predecessors (node2, is_ancestor_callback,
- &baton, pool));
- if (baton.is_ancestor)
- *is_ancestor = TRUE;
-
- return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_fs_fs__dag_is_parent (svn_boolean_t *is_parent,
- dag_node_t *node1,
- dag_node_t *node2,
- apr_pool_t *pool)
-{
- struct is_ancestor_baton baton;
- const svn_fs_id_t
- *id1 = svn_fs_fs__dag_get_id (node1),
- *id2 = svn_fs_fs__dag_get_id (node2);
-
- /* Pessimism. */
- *is_parent = FALSE;
-
- /* Parentry holds relatedness as a prerequisite. */
- if (! svn_fs_fs__id_check_related (id1, id2))
- return SVN_NO_ERROR;
-
- baton.is_ancestor = FALSE;
- baton.need_parent = TRUE;
- baton.node1_id = id1;
-
- SVN_ERR (svn_fs_fs__dag_walk_predecessors (node2, is_ancestor_callback,
- &baton, pool));
- if (baton.is_ancestor)
- *is_parent = TRUE;
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
 svn_fs_fs__dag_get_copyroot (svn_revnum_t *rev,
                              const char **path,
                              dag_node_t *node,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Dec 1 17:00:15 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.