You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2012/03/27 01:23:49 UTC
svn commit: r1305667 [3/7] - in /subversion/branches/inheritable-props: ./
subversion/bindings/swig/python/svn/ subversion/bindings/swig/python/tests/
subversion/bindings/swig/ruby/svn/ subversion/bindings/swig/ruby/test/
subversion/include/private/ su...
Modified: subversion/branches/inheritable-props/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_fs_fs/dag.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_fs_fs/dag.c Mon Mar 26 23:23:46 2012
@@ -70,6 +70,9 @@ struct dag_node_t
things for you. */
node_revision_t *node_revision;
+ /* The pool to allocate NODE_REVISION in. */
+ apr_pool_t *node_pool;
+
/* the path at which this node was created. */
const char *created_path;
};
@@ -139,7 +142,7 @@ copy_node_revision(node_revision_t *node
/* Set *NODEREV_P to the cached node-revision for NODE.
If the node-revision was not already cached in NODE, read it in,
- allocating the cache in POOL.
+ allocating the cache in NODE->NODE_POOL.
If you plan to change the contents of NODE, be careful! We're
handing you a pointer directly to our cached node-revision, not
@@ -150,8 +153,7 @@ copy_node_revision(node_revision_t *node
the structure at all. */
static svn_error_t *
get_node_revision(node_revision_t **noderev_p,
- dag_node_t *node,
- apr_pool_t *pool)
+ dag_node_t *node)
{
node_revision_t *noderev;
@@ -159,7 +161,7 @@ get_node_revision(node_revision_t **node
if (! node->node_revision)
{
SVN_ERR(svn_fs_fs__get_node_revision(&noderev, node->fs,
- node->id, pool));
+ node->id, node->node_pool));
node->node_revision = noderev;
}
@@ -190,7 +192,8 @@ svn_fs_fs__dag_get_node(dag_node_t **nod
new_node->id = svn_fs_fs__id_copy(id, pool);
/* Grab the contents so we can inspect the node's kind and created path. */
- SVN_ERR(get_node_revision(&noderev, new_node, pool));
+ new_node->node_pool = pool;
+ SVN_ERR(get_node_revision(&noderev, new_node));
/* Initialize the KIND and CREATED_PATH attributes */
new_node->kind = noderev->kind;
@@ -227,12 +230,11 @@ svn_fs_fs__dag_get_revision(svn_revnum_t
svn_error_t *
svn_fs_fs__dag_get_predecessor_id(const svn_fs_id_t **id_p,
- dag_node_t *node,
- apr_pool_t *pool)
+ dag_node_t *node)
{
node_revision_t *noderev;
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
*id_p = noderev->predecessor_id;
return SVN_NO_ERROR;
}
@@ -240,44 +242,40 @@ svn_fs_fs__dag_get_predecessor_id(const
svn_error_t *
svn_fs_fs__dag_get_predecessor_count(int *count,
- dag_node_t *node,
- apr_pool_t *pool)
+ dag_node_t *node)
{
node_revision_t *noderev;
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
*count = noderev->predecessor_count;
return SVN_NO_ERROR;
}
svn_error_t *
svn_fs_fs__dag_get_mergeinfo_count(apr_int64_t *count,
- dag_node_t *node,
- apr_pool_t *pool)
+ dag_node_t *node)
{
node_revision_t *noderev;
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
*count = noderev->mergeinfo_count;
return SVN_NO_ERROR;
}
svn_error_t *
svn_fs_fs__dag_has_mergeinfo(svn_boolean_t *has_mergeinfo,
- dag_node_t *node,
- apr_pool_t *pool)
+ dag_node_t *node)
{
node_revision_t *noderev;
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
*has_mergeinfo = noderev->has_mergeinfo;
return SVN_NO_ERROR;
}
svn_error_t *
svn_fs_fs__dag_has_descendants_with_mergeinfo(svn_boolean_t *do_they,
- dag_node_t *node,
- apr_pool_t *pool)
+ dag_node_t *node)
{
node_revision_t *noderev;
@@ -287,7 +285,7 @@ svn_fs_fs__dag_has_descendants_with_merg
return SVN_NO_ERROR;
}
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
if (noderev->mergeinfo_count > 1)
*do_they = TRUE;
else if (noderev->mergeinfo_count == 1 && !noderev->has_mergeinfo)
@@ -309,15 +307,13 @@ static svn_error_t *
dir_entry_id_from_node(const svn_fs_id_t **id_p,
dag_node_t *parent,
const char *name,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_fs_dirent_t *dirent;
- apr_pool_t *subpool = svn_pool_create(pool);
- SVN_ERR(svn_fs_fs__dag_dir_entry(&dirent, parent, name, subpool, pool));
- *id_p = dirent ? svn_fs_fs__id_copy(dirent->id, pool) : NULL;
-
- svn_pool_destroy(subpool);
+ SVN_ERR(svn_fs_fs__dag_dir_entry(&dirent, parent, name, scratch_pool));
+ *id_p = dirent ? svn_fs_fs__id_copy(dirent->id, result_pool) : NULL;
return SVN_NO_ERROR;
}
@@ -342,7 +338,7 @@ set_entry(dag_node_t *parent,
node_revision_t *parent_noderev;
/* Get the parent's node-revision. */
- SVN_ERR(get_node_revision(&parent_noderev, parent, pool));
+ SVN_ERR(get_node_revision(&parent_noderev, parent));
/* Set the new entry. */
return svn_fs_fs__set_entry(parent->fs, txn_id, parent_noderev, name, id,
@@ -355,7 +351,7 @@ set_entry(dag_node_t *parent,
will be a file. The new node will be allocated in POOL. PARENT
must be mutable, and must not have an entry named NAME.
- Use POOL for all allocations including caching the node_revision in PARENT.
+ Use POOL for all allocations, except caching the node_revision in PARENT.
*/
static svn_error_t *
make_entry(dag_node_t **child_p,
@@ -392,7 +388,7 @@ make_entry(dag_node_t **child_p,
new_noderev.kind = is_dir ? svn_node_dir : svn_node_file;
new_noderev.created_path = svn_fspath__join(parent_path, name, pool);
- SVN_ERR(get_node_revision(&parent_noderev, parent, pool));
+ SVN_ERR(get_node_revision(&parent_noderev, parent));
new_noderev.copyroot_path = apr_pstrdup(pool,
parent_noderev->copyroot_path);
new_noderev.copyroot_rev = parent_noderev->copyroot_rev;
@@ -419,12 +415,11 @@ make_entry(dag_node_t **child_p,
svn_error_t *
svn_fs_fs__dag_dir_entries(apr_hash_t **entries,
dag_node_t *node,
- apr_pool_t *pool,
- apr_pool_t *node_pool)
+ apr_pool_t *pool)
{
node_revision_t *noderev;
- SVN_ERR(get_node_revision(&noderev, node, node_pool));
+ SVN_ERR(get_node_revision(&noderev, node));
if (noderev->kind != svn_node_dir)
return svn_error_create(SVN_ERR_FS_NOT_DIRECTORY, NULL,
@@ -437,11 +432,10 @@ svn_error_t *
svn_fs_fs__dag_dir_entry(svn_fs_dirent_t **dirent,
dag_node_t *node,
const char* name,
- apr_pool_t *pool,
- apr_pool_t *node_pool)
+ apr_pool_t *pool)
{
node_revision_t *noderev;
- SVN_ERR(get_node_revision(&noderev, node, node_pool));
+ SVN_ERR(get_node_revision(&noderev, node));
if (noderev->kind != svn_node_dir)
return svn_error_create(SVN_ERR_FS_NOT_DIRECTORY, NULL,
@@ -488,7 +482,7 @@ svn_fs_fs__dag_get_proplist(apr_hash_t *
node_revision_t *noderev;
apr_hash_t *proplist = NULL;
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
SVN_ERR(svn_fs_fs__get_proplist(&proplist, node->fs,
noderev, pool));
@@ -517,7 +511,7 @@ svn_fs_fs__dag_set_proplist(dag_node_t *
}
/* Go get a fresh NODE-REVISION for this node. */
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
/* Set the new proplist. */
return svn_fs_fs__set_proplist(node->fs, noderev, proplist, pool);
@@ -545,7 +539,7 @@ svn_fs_fs__dag_increment_mergeinfo_count
return SVN_NO_ERROR;
/* Go get a fresh NODE-REVISION for this node. */
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
noderev->mergeinfo_count += increment;
if (noderev->mergeinfo_count < 0)
@@ -594,7 +588,7 @@ svn_fs_fs__dag_set_has_mergeinfo(dag_nod
}
/* Go get a fresh NODE-REVISION for this node. */
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
noderev->has_mergeinfo = has_mergeinfo;
@@ -658,6 +652,7 @@ svn_fs_fs__dag_clone_child(dag_node_t **
dag_node_t *cur_entry; /* parent's current entry named NAME */
const svn_fs_id_t *new_node_id; /* node id we'll put into NEW_NODE */
svn_fs_t *fs = svn_fs_fs__dag_get_fs(parent);
+ apr_pool_t *subpool = svn_pool_create(pool);
/* First check that the parent is mutable. */
if (! svn_fs_fs__dag_check_mutable(parent))
@@ -672,7 +667,7 @@ svn_fs_fs__dag_clone_child(dag_node_t **
"Attempted to make a child clone with an illegal name '%s'", name);
/* Find the node named NAME in PARENT's entries list if it exists. */
- SVN_ERR(svn_fs_fs__dag_open(&cur_entry, parent, name, pool));
+ SVN_ERR(svn_fs_fs__dag_open(&cur_entry, parent, name, pool, subpool));
/* Check for mutability in the node we found. If it's mutable, we
don't need to clone it. */
@@ -686,11 +681,11 @@ svn_fs_fs__dag_clone_child(dag_node_t **
node_revision_t *noderev, *parent_noderev;
/* Go get a fresh NODE-REVISION for current child node. */
- SVN_ERR(get_node_revision(&noderev, cur_entry, pool));
+ SVN_ERR(get_node_revision(&noderev, cur_entry));
if (is_parent_copyroot)
{
- SVN_ERR(get_node_revision(&parent_noderev, parent, pool));
+ SVN_ERR(get_node_revision(&parent_noderev, parent));
noderev->copyroot_rev = parent_noderev->copyroot_rev;
noderev->copyroot_path = apr_pstrdup(pool,
parent_noderev->copyroot_path);
@@ -714,6 +709,7 @@ svn_fs_fs__dag_clone_child(dag_node_t **
}
/* Initialize the youngster. */
+ svn_pool_destroy(subpool);
return svn_fs_fs__dag_get_node(child_p, fs, new_node_id, pool);
}
@@ -778,7 +774,7 @@ svn_fs_fs__dag_delete(dag_node_t *parent
"Attempted to delete a node with an illegal name '%s'", name);
/* Get a fresh NODE-REVISION for the parent node. */
- SVN_ERR(get_node_revision(&parent_noderev, parent, pool));
+ SVN_ERR(get_node_revision(&parent_noderev, parent));
subpool = svn_pool_create(pool);
@@ -851,7 +847,7 @@ svn_fs_fs__dag_delete_if_mutable(svn_fs_
apr_hash_index_t *hi;
/* Loop over hash entries */
- SVN_ERR(svn_fs_fs__dag_dir_entries(&entries, node, pool, pool));
+ SVN_ERR(svn_fs_fs__dag_dir_entries(&entries, node, pool));
if (entries)
{
for (hi = apr_hash_first(pool, entries);
@@ -912,7 +908,7 @@ svn_fs_fs__dag_get_contents(svn_stream_t
"Attempted to get textual contents of a *non*-file node");
/* Go get a fresh node-revision for FILE. */
- SVN_ERR(get_node_revision(&noderev, file, pool));
+ SVN_ERR(get_node_revision(&noderev, file));
/* Get a stream to the contents. */
SVN_ERR(svn_fs_fs__get_contents(&contents, file->fs,
@@ -942,10 +938,10 @@ svn_fs_fs__dag_get_file_delta_stream(svn
/* Go get fresh node-revisions for the nodes. */
if (source)
- SVN_ERR(get_node_revision(&src_noderev, source, pool));
+ SVN_ERR(get_node_revision(&src_noderev, source));
else
src_noderev = NULL;
- SVN_ERR(get_node_revision(&tgt_noderev, target, pool));
+ SVN_ERR(get_node_revision(&tgt_noderev, target));
/* Get the delta stream. */
return svn_fs_fs__get_file_delta_stream(stream_p, target->fs,
@@ -967,7 +963,7 @@ svn_fs_fs__dag_file_length(svn_filesize_
"Attempted to get length of a *non*-file node");
/* Go get a fresh node-revision for FILE, and . */
- SVN_ERR(get_node_revision(&noderev, file, pool));
+ SVN_ERR(get_node_revision(&noderev, file));
return svn_fs_fs__file_length(length, noderev, pool);
}
@@ -986,7 +982,7 @@ svn_fs_fs__dag_file_checksum(svn_checksu
(SVN_ERR_FS_NOT_FILE, NULL,
"Attempted to get checksum of a *non*-file node");
- SVN_ERR(get_node_revision(&noderev, file, pool));
+ SVN_ERR(get_node_revision(&noderev, file));
return svn_fs_fs__file_checksum(checksum, noderev, kind, pool);
}
@@ -1013,7 +1009,7 @@ svn_fs_fs__dag_get_edit_stream(svn_strea
"Attempted to set textual contents of an immutable node");
/* Get the node revision. */
- SVN_ERR(get_node_revision(&noderev, file, pool));
+ SVN_ERR(get_node_revision(&noderev, file));
SVN_ERR(svn_fs_fs__set_contents(&ws, file->fs, noderev, pool));
@@ -1066,6 +1062,8 @@ svn_fs_fs__dag_dup(const dag_node_t *nod
new_node->node_revision->is_fresh_txn_root =
node->node_revision->is_fresh_txn_root;
}
+ new_node->node_pool = pool;
+
return new_node;
}
@@ -1092,6 +1090,10 @@ svn_fs_fs__dag_serialize(char **data,
svn_temp_serializer__set_null(context,
(const void * const *)&node->node_revision);
+ /* The deserializer will use its own pool. */
+ svn_temp_serializer__set_null(context,
+ (const void * const *)&node->node_pool);
+
/* serialize other sub-structures */
svn_fs_fs__id_serialize(context, (const svn_fs_id_t **)&node->id);
svn_fs_fs__id_serialize(context, &node->fresh_root_predecessor_id);
@@ -1124,6 +1126,7 @@ svn_fs_fs__dag_deserialize(void **out,
svn_fs_fs__id_deserialize(node,
(svn_fs_id_t **)&node->fresh_root_predecessor_id);
svn_fs_fs__noderev_deserialize(node, &node->node_revision);
+ node->node_pool = pool;
svn_temp_deserializer__resolve(node, (void**)&node->created_path);
@@ -1137,12 +1140,14 @@ svn_error_t *
svn_fs_fs__dag_open(dag_node_t **child_p,
dag_node_t *parent,
const char *name,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
const svn_fs_id_t *node_id;
/* Ensure that NAME exists in PARENT's entry list. */
- SVN_ERR(dir_entry_id_from_node(&node_id, parent, name, pool));
+ SVN_ERR(dir_entry_id_from_node(&node_id, parent, name,
+ scratch_pool, scratch_pool));
if (! node_id)
return svn_error_createf
(SVN_ERR_FS_NOT_FOUND, NULL,
@@ -1156,7 +1161,7 @@ svn_fs_fs__dag_open(dag_node_t **child_p
/* Now get the node that was requested. */
return svn_fs_fs__dag_get_node(child_p, svn_fs_fs__dag_get_fs(parent),
- node_id, pool);
+ node_id, result_pool);
}
@@ -1180,7 +1185,7 @@ svn_fs_fs__dag_copy(dag_node_t *to_node,
svn_fs_t *fs = svn_fs_fs__dag_get_fs(from_node);
/* Make a copy of the original node revision. */
- SVN_ERR(get_node_revision(&from_noderev, from_node, pool));
+ SVN_ERR(get_node_revision(&from_noderev, from_node));
to_noderev = copy_node_revision(from_noderev, pool);
/* Reserve a copy ID for this new copy. */
@@ -1222,8 +1227,7 @@ svn_error_t *
svn_fs_fs__dag_things_different(svn_boolean_t *props_changed,
svn_boolean_t *contents_changed,
dag_node_t *node1,
- dag_node_t *node2,
- apr_pool_t *pool)
+ dag_node_t *node2)
{
node_revision_t *noderev1, *noderev2;
@@ -1233,8 +1237,8 @@ svn_fs_fs__dag_things_different(svn_bool
return SVN_NO_ERROR;
/* The node revision skels for these two nodes. */
- SVN_ERR(get_node_revision(&noderev1, node1, pool));
- SVN_ERR(get_node_revision(&noderev2, node2, pool));
+ SVN_ERR(get_node_revision(&noderev1, node1));
+ SVN_ERR(get_node_revision(&noderev2, node2));
/* Compare property keys. */
if (props_changed != NULL)
@@ -1253,13 +1257,12 @@ svn_fs_fs__dag_things_different(svn_bool
svn_error_t *
svn_fs_fs__dag_get_copyroot(svn_revnum_t *rev,
const char **path,
- dag_node_t *node,
- apr_pool_t *pool)
+ dag_node_t *node)
{
node_revision_t *noderev;
/* Go get a fresh node-revision for NODE. */
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
*rev = noderev->copyroot_rev;
*path = noderev->copyroot_path;
@@ -1269,13 +1272,12 @@ svn_fs_fs__dag_get_copyroot(svn_revnum_t
svn_error_t *
svn_fs_fs__dag_get_copyfrom_rev(svn_revnum_t *rev,
- dag_node_t *node,
- apr_pool_t *pool)
+ dag_node_t *node)
{
node_revision_t *noderev;
/* Go get a fresh node-revision for NODE. */
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
*rev = noderev->copyfrom_rev;
@@ -1284,13 +1286,12 @@ svn_fs_fs__dag_get_copyfrom_rev(svn_revn
svn_error_t *
svn_fs_fs__dag_get_copyfrom_path(const char **path,
- dag_node_t *node,
- apr_pool_t *pool)
+ dag_node_t *node)
{
node_revision_t *noderev;
/* Go get a fresh node-revision for NODE. */
- SVN_ERR(get_node_revision(&noderev, node, pool));
+ SVN_ERR(get_node_revision(&noderev, node));
*path = noderev->copyfrom_path;
@@ -1309,8 +1310,8 @@ svn_fs_fs__dag_update_ancestry(dag_node_
(SVN_ERR_FS_NOT_MUTABLE, NULL,
_("Attempted to update ancestry of non-mutable node"));
- SVN_ERR(get_node_revision(&source_noderev, source, pool));
- SVN_ERR(get_node_revision(&target_noderev, target, pool));
+ SVN_ERR(get_node_revision(&source_noderev, source));
+ SVN_ERR(get_node_revision(&target_noderev, target));
target_noderev->predecessor_id = source->id;
target_noderev->predecessor_count = source_noderev->predecessor_count;
Modified: subversion/branches/inheritable-props/subversion/libsvn_fs_fs/dag.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_fs_fs/dag.h?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_fs_fs/dag.h (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_fs_fs/dag.h Mon Mar 26 23:23:46 2012
@@ -121,58 +121,39 @@ const char *svn_fs_fs__dag_get_created_p
/* Set *ID_P to the node revision ID of NODE's immediate predecessor,
- or NULL if NODE has no predecessor, allocating from POOL.
-
- Use POOL for all allocations, including to cache the node_revision in
- NODE.
+ or NULL if NODE has no predecessor.
*/
svn_error_t *svn_fs_fs__dag_get_predecessor_id(const svn_fs_id_t **id_p,
- dag_node_t *node,
- apr_pool_t *pool);
+ dag_node_t *node);
/* Set *COUNT to the number of predecessors NODE has (recursively), or
- -1 if not known, allocating from POOL.
-
- Use POOL for all allocations, including to cache the node_revision in
- NODE.
+ -1 if not known.
*/
+/* ### This function is currently only used by 'verify'. */
svn_error_t *svn_fs_fs__dag_get_predecessor_count(int *count,
- dag_node_t *node,
- apr_pool_t *pool);
+ dag_node_t *node);
/* Set *COUNT to the number of node under NODE (inclusive) with
- svn:mergeinfo properties, allocating from POOL.
-
- Use POOL for all allocations, including to cache the node_revision in
- NODE.
+ svn:mergeinfo properties.
*/
svn_error_t *svn_fs_fs__dag_get_mergeinfo_count(apr_int64_t *count,
- dag_node_t *node,
- apr_pool_t *pool);
+ dag_node_t *node);
/* Set *DO_THEY to a flag indicating whether or not NODE is a
directory with at least one descendant (not including itself) with
svn:mergeinfo.
-
- Use POOL for all allocations, including to cache the node_revision in
- NODE.
*/
svn_error_t *
svn_fs_fs__dag_has_descendants_with_mergeinfo(svn_boolean_t *do_they,
- dag_node_t *node,
- apr_pool_t *pool);
+ dag_node_t *node);
/* Set *HAS_MERGEINFO to a flag indicating whether or not NODE itself
has svn:mergeinfo set on it.
-
- Use POOL for all allocations, including to cache the node_revision in
- NODE.
*/
svn_error_t *
svn_fs_fs__dag_has_mergeinfo(svn_boolean_t *has_mergeinfo,
- dag_node_t *node,
- apr_pool_t *pool);
+ dag_node_t *node);
/* Return non-zero IFF NODE is currently mutable. */
svn_boolean_t svn_fs_fs__dag_check_mutable(const dag_node_t *node);
@@ -188,8 +169,7 @@ svn_node_kind_t svn_fs_fs__dag_node_kind
If properties do not exist on NODE, *PROPLIST_P will be set to
NULL.
- Use POOL for all allocations, including to cache the node_revision in
- NODE.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_get_proplist(apr_hash_t **proplist_p,
dag_node_t *node,
@@ -198,8 +178,7 @@ svn_error_t *svn_fs_fs__dag_get_proplist
/* Set the property list of NODE to PROPLIST, allocating from POOL.
The node being changed must be mutable.
- Use POOL for all allocations, including to cache the node_revision in
- NODE.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_set_proplist(dag_node_t *node,
apr_hash_t *proplist,
@@ -208,8 +187,7 @@ svn_error_t *svn_fs_fs__dag_set_proplist
/* Increment the mergeinfo_count field on NODE by INCREMENT. The node
being changed must be mutable.
- Use POOL for all allocations, including to cache the node_revision in
- NODE.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_increment_mergeinfo_count(dag_node_t *node,
apr_int64_t increment,
@@ -218,8 +196,7 @@ svn_error_t *svn_fs_fs__dag_increment_me
/* Set the has-mergeinfo flag on NODE to HAS_MERGEINFO. The node
being changed must be mutable.
- Use POOL for all allocations, including to cache the node_revision in
- NODE.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_set_has_mergeinfo(dag_node_t *node,
svn_boolean_t has_mergeinfo,
@@ -274,40 +251,35 @@ svn_error_t *svn_fs_fs__dag_clone_root(d
/* Open the node named NAME in the directory PARENT. Set *CHILD_P to
- the new node, allocated in POOL. NAME must be a single path
+ the new node, allocated in RESULT_POOL. NAME must be a single path
component; it cannot be a slash-separated directory path.
-
- Use POOL for all allocations, including to cache the node_revision in
- PARENT.
*/
-svn_error_t *svn_fs_fs__dag_open(dag_node_t **child_p,
- dag_node_t *parent,
- const char *name,
- apr_pool_t *pool);
+svn_error_t *
+svn_fs_fs__dag_open(dag_node_t **child_p,
+ dag_node_t *parent,
+ const char *name,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Set *ENTRIES_P to a hash table of NODE's entries. The keys of the
table are entry names, and the values are svn_fs_dirent_t's. The
returned table (and its keys and values) is allocated in POOL,
- which is also used for temporary allocations. NODE_POOL is used
- for any allocation of memory that needs to live as long as NODE
- lives. */
+ which is also used for temporary allocations. */
svn_error_t *svn_fs_fs__dag_dir_entries(apr_hash_t **entries_p,
dag_node_t *node,
- apr_pool_t *pool,
- apr_pool_t *node_pool);
+ apr_pool_t *pool);
/* Fetches the NODE's entries and returns a copy of the entry selected
by the key value given in NAME and set *DIRENT to a copy of that
entry. If such entry was found, the copy will be allocated in POOL.
- Otherwise, the *DIRENT will be set to NULL. NODE_POOL is used for
- any allocation of memory that needs to live as long as NODE lives.
+ Otherwise, the *DIRENT will be set to NULL.
*/
+/* ### This function is currently only called from dag.c. */
svn_error_t * svn_fs_fs__dag_dir_entry(svn_fs_dirent_t **dirent,
dag_node_t *node,
const char* name,
- apr_pool_t *pool,
- apr_pool_t *node_pool);
+ apr_pool_t *pool);
/* Set ENTRY_NAME in NODE to point to ID (with kind KIND), allocating
from POOL. NODE must be a mutable directory. ID can refer to a
@@ -343,8 +315,7 @@ svn_error_t *svn_fs_fs__dag_set_entry(da
TXN_ID is the Subversion transaction under which this occurs.
- Use POOL for all allocations, including to cache the node_revision in
- FILE.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_clone_child(dag_node_t **child_p,
dag_node_t *parent,
@@ -366,8 +337,7 @@ svn_error_t *svn_fs_fs__dag_clone_child(
If return SVN_ERR_FS_NO_SUCH_ENTRY, then there is no entry NAME in
PARENT.
- Use POOL for all allocations, including to cache the node_revision in
- FILE.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_delete(dag_node_t *parent,
const char *name,
@@ -408,8 +378,7 @@ svn_error_t *svn_fs_fs__dag_delete_if_mu
not currently have an entry named NAME. TXN_ID is the Subversion
transaction under which this occurs.
- Use POOL for all allocations, including to cache the node_revision in
- PARENT.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_make_dir(dag_node_t **child_p,
dag_node_t *parent,
@@ -428,8 +397,7 @@ svn_error_t *svn_fs_fs__dag_make_dir(dag
If FILE is not a file, return SVN_ERR_FS_NOT_FILE.
- Use POOL for all allocations, including to cache the node_revision in
- FILE.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_get_contents(svn_stream_t **contents,
dag_node_t *file,
@@ -440,8 +408,7 @@ svn_error_t *svn_fs_fs__dag_get_contents
the contents of TARGET, allocated in POOL. If SOURCE is null, the empty
string will be used.
- Use POOL for all allocations, including to cache the node_revision in
- SOURCE and TARGET.
+ Use POOL for all allocations.
*/
svn_error_t *
svn_fs_fs__dag_get_file_delta_stream(svn_txdelta_stream_t **stream_p,
@@ -455,8 +422,7 @@ svn_fs_fs__dag_get_file_delta_stream(svn
Any previous edits on the file will be deleted, and a new edit
stream will be constructed.
- Use POOL for all allocations, including to cache the node_revision in
- FILE.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_get_edit_stream(svn_stream_t **contents,
dag_node_t *file,
@@ -482,8 +448,7 @@ svn_error_t *svn_fs_fs__dag_finalize_edi
/* Set *LENGTH to the length of the contents of FILE.
- Use POOL for all allocations, including to cache the node_revision in
- FILE.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_file_length(svn_filesize_t *length,
dag_node_t *file,
@@ -495,8 +460,7 @@ svn_error_t *svn_fs_fs__dag_file_length(
If no stored checksum is available, do not calculate the checksum,
just put NULL into CHECKSUM.
- Use POOL for all allocations, including to cache the node_revision in
- FILE.
+ Use POOL for all allocations.
*/
svn_error_t *
svn_fs_fs__dag_file_checksum(svn_checksum_t **checksum,
@@ -512,8 +476,7 @@ svn_fs_fs__dag_file_checksum(svn_checksu
canonicalized absolute path of the parent directory. TXN_ID is the
Subversion transaction under which this occurs.
- Use POOL for all allocations, including to cache the node_revision in
- PARENT.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_make_file(dag_node_t **child_p,
dag_node_t *parent,
@@ -538,8 +501,7 @@ svn_error_t *svn_fs_fs__dag_make_file(da
If PRESERVE_HISTORY is false, FROM_PATH and FROM_REV are ignored.
- Use POOL for all allocations, including to cache the node_revision in
- FROM_NODE.
+ Use POOL for all allocations.
*/
svn_error_t *svn_fs_fs__dag_copy(dag_node_t *to_node,
const char *entry,
@@ -569,39 +531,29 @@ svn_error_t *svn_fs_fs__dag_copy(dag_nod
may leave us with a slight chance of a false positive, though I
don't really see how that would happen in practice. Nevertheless,
it should probably be fixed.
-
- Use POOL for all allocations, including to cache the node_revision in NODE1
- and NODE2.
*/
svn_error_t *svn_fs_fs__dag_things_different(svn_boolean_t *props_changed,
svn_boolean_t *contents_changed,
dag_node_t *node1,
- dag_node_t *node2,
- apr_pool_t *pool);
+ dag_node_t *node2);
/* Set *REV and *PATH to the copyroot revision and path of node NODE, or
to SVN_INVALID_REVNUM and NULL if no copyroot exists.
- Use POOL for all allocations, including to cache the node_revision in NODE.
*/
svn_error_t *svn_fs_fs__dag_get_copyroot(svn_revnum_t *rev,
const char **path,
- dag_node_t *node,
- apr_pool_t *pool);
+ dag_node_t *node);
/* Set *REV to the copyfrom revision associated with NODE.
- Use POOL for all allocations, including to cache the node_revision in NODE.
*/
svn_error_t *svn_fs_fs__dag_get_copyfrom_rev(svn_revnum_t *rev,
- dag_node_t *node,
- apr_pool_t *pool);
+ dag_node_t *node);
/* Set *PATH to the copyfrom path associated with NODE.
- Use POOL for all allocations, including to cache the node_revision in NODE.
*/
svn_error_t *svn_fs_fs__dag_get_copyfrom_path(const char **path,
- dag_node_t *node,
- apr_pool_t *pool);
+ dag_node_t *node);
/* Update *TARGET so that SOURCE is it's predecessor.
*/
Modified: subversion/branches/inheritable-props/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_fs_fs/fs_fs.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_fs_fs/fs_fs.c Mon Mar 26 23:23:46 2012
@@ -2718,8 +2718,6 @@ set_revision_proplist(svn_fs_t *fs,
(Whereas the rev file should already exist at this point.) */
SVN_ERR(svn_fs_fs__path_rev_absolute(&perms_reference, fs, rev, pool));
SVN_ERR(move_into_place(tmp_path, final_path, perms_reference, pool));
-
- return SVN_NO_ERROR;
}
return SVN_NO_ERROR;
@@ -5004,6 +5002,7 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
apr_file_t *file;
svn_stream_t *out;
fs_fs_data_t *ffd = fs->fsap_data;
+ apr_pool_t *subpool = svn_pool_create(pool);
if (!rep || !rep->txn_id)
{
@@ -5011,7 +5010,8 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
{
apr_hash_t *entries;
- apr_pool_t *subpool = svn_pool_create(pool);
+
+ svn_pool_clear(subpool);
/* Before we can modify the directory, we need to dump its old
contents into a mutable representation file. */
@@ -5024,7 +5024,7 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
out = svn_stream_from_aprfile2(file, TRUE, pool);
SVN_ERR(svn_hash_write2(entries, out, SVN_HASH_TERMINATOR, subpool));
- svn_pool_destroy(subpool);
+ svn_pool_clear(subpool);
}
/* Mark the node-rev's data rep as mutable. */
@@ -5046,10 +5046,9 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
}
/* if we have a directory cache for this transaction, update it */
+ svn_pool_clear(subpool);
if (ffd->txn_dir_cache)
{
- apr_pool_t *subpool = svn_pool_create(pool);
-
/* build parameters: (name, new entry) pair */
const char *key =
svn_fs_fs__id_unparse(parent_noderev->id, subpool)->data;
@@ -5064,28 +5063,31 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
}
/* actually update the cached directory (if cached) */
- SVN_ERR(svn_cache__set_partial(ffd->txn_dir_cache, key, svn_fs_fs__replace_dir_entry, &baton, subpool));
-
- svn_pool_destroy(subpool);
+ SVN_ERR(svn_cache__set_partial(ffd->txn_dir_cache, key,
+ svn_fs_fs__replace_dir_entry, &baton,
+ subpool));
}
+ svn_pool_clear(subpool);
/* Append an incremental hash entry for the entry change. */
if (id)
{
- const char *val = unparse_dir_entry(kind, id, pool);
+ const char *val = unparse_dir_entry(kind, id, subpool);
- SVN_ERR(svn_stream_printf(out, pool, "K %" APR_SIZE_T_FMT "\n%s\n"
+ SVN_ERR(svn_stream_printf(out, subpool, "K %" APR_SIZE_T_FMT "\n%s\n"
"V %" APR_SIZE_T_FMT "\n%s\n",
strlen(name), name,
strlen(val), val));
}
else
{
- SVN_ERR(svn_stream_printf(out, pool, "D %" APR_SIZE_T_FMT "\n%s\n",
+ SVN_ERR(svn_stream_printf(out, subpool, "D %" APR_SIZE_T_FMT "\n%s\n",
strlen(name), name));
}
- return svn_io_file_close(file, pool);
+ SVN_ERR(svn_io_file_close(file, subpool));
+ svn_pool_destroy(subpool);
+ return SVN_NO_ERROR;
}
/* Write a single change entry, path PATH, change CHANGE, and copyfrom
@@ -5909,7 +5911,7 @@ validate_root_noderev(svn_fs_t *fs,
This kind of corruption was seen on svn.apache.org (both on
the root noderev and on other fspaths' noderevs); see
- http://mid.gmane.org/20111002202833.GA12373@daniel3.local
+ issue #4129.
Normally (rev == root_noderev->predecessor_count), but here we
use a more roundabout check that should only trigger on new instances
@@ -7946,58 +7948,24 @@ svn_fs_fs__verify(svn_fs_t *fs,
start, end,
pool));
- /* Issue #4129: bogus pred-counts on the root node-rev. */
+ /* Issue #4129: bogus pred-counts and minfo-cnt's on the root node-rev
+ (and elsewhere). This code makes more thorough checks that the
+ commit-time checks in validate_root_noderev(). */
{
svn_revnum_t i;
- int predecessor_predecessor_count;
-
- /* Compute PREDECESSOR_PREDECESSOR_COUNT. */
- if (start == 0)
- /* The value that passes the if() at the end of the loop. */
- predecessor_predecessor_count = -1;
- else
- {
- svn_fs_id_t *root_id;
- node_revision_t *root_noderev;
- SVN_ERR(svn_fs_fs__rev_get_root(&root_id, fs, start-1, iterpool));
- SVN_ERR(svn_fs_fs__get_node_revision(&root_noderev, fs, root_id,
- iterpool));
- predecessor_predecessor_count = root_noderev->predecessor_count;
- }
-
for (i = start; i <= end; i++)
{
- /* ### Caching.
-
- svn_fs_fs__rev_get_root() consults caches, which in verify we
- don't want. But we can't easily bypass that, as
- svn_fs_revision_root()+svn_fs_node_id()'s implementation uses
- svn_fs_fs__rev_get_root() too.
-
- ### A future revision will make fs_verify() disable caches when it
- ### opens ffd.
- */
- svn_fs_id_t *root_id;
- node_revision_t *root_noderev;
+ svn_fs_root_t *root;
- if ((i % 128) == 0) /* uneducated guess */
- svn_pool_clear(iterpool);
-
- /* Fetch ROOT_NODEREV. */
- SVN_ERR(svn_fs_fs__rev_get_root(&root_id, fs, i, iterpool));
- SVN_ERR(svn_fs_fs__get_node_revision(&root_noderev, fs, root_id,
- iterpool));
-
- /* Check correctness. (Compare validate_root_noderev().) */
- if (1+predecessor_predecessor_count != root_noderev->predecessor_count)
- return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
- _("predecessor count for "
- "the root node-revision is wrong: "
- "r%ld has %d, but r%ld has %d"),
- i, root_noderev->predecessor_count,
- i-1, predecessor_predecessor_count);
+ svn_pool_clear(iterpool);
- predecessor_predecessor_count = root_noderev->predecessor_count;
+ /* ### TODO: Make sure caches are disabled.
+
+ When this code is called in the library, we want to ensure we
+ use the on-disk data --- rather than some data that was read
+ in the possibly-distance past and cached since. */
+ SVN_ERR(svn_fs_fs__revision_root(&root, fs, i, iterpool));
+ SVN_ERR(svn_fs_fs__verify_root(root, iterpool));
}
}
Modified: subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.c Mon Mar 26 23:23:46 2012
@@ -502,7 +502,7 @@ get_copy_inheritance(copy_id_inherit_t *
or if it is a branch point that we are accessing via its original
copy destination path. */
SVN_ERR(svn_fs_fs__dag_get_copyroot(©root_rev, ©root_path,
- child->node,pool));
+ child->node));
SVN_ERR(svn_fs_fs__revision_root(©root_root, fs, copyroot_rev, pool));
SVN_ERR(get_dag(©root_node, copyroot_root, copyroot_path, pool));
copyroot_id = svn_fs_fs__dag_get_id(copyroot_node);
@@ -594,6 +594,7 @@ open_path(parent_path_t **parent_path_p,
const char *rest; /* The portion of PATH we haven't traversed yet. */
const char *canon_path = svn_fs__canonicalize_abspath(path, pool);
const char *path_so_far = "/";
+ apr_pool_t *iterpool = svn_pool_create(pool);
/* Make a parent_path item for the root node, using its own current
copy id. */
@@ -614,6 +615,8 @@ open_path(parent_path_t **parent_path_p,
char *entry;
dag_node_t *child;
+ svn_pool_clear(iterpool);
+
/* Parse out the next entry from the path. */
entry = svn_fs__next_entry_name(&next, rest, pool);
@@ -642,7 +645,7 @@ open_path(parent_path_t **parent_path_p,
if (cached_node)
child = cached_node;
else
- err = svn_fs_fs__dag_open(&child, here, entry, pool);
+ err = svn_fs_fs__dag_open(&child, here, entry, pool, iterpool);
/* "file not found" requires special handling. */
if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
@@ -676,14 +679,14 @@ open_path(parent_path_t **parent_path_p,
if (txn_id)
{
SVN_ERR(get_copy_inheritance(&inherit, ©_path,
- fs, parent_path, txn_id, pool));
+ fs, parent_path, txn_id, iterpool));
parent_path->copy_inherit = inherit;
parent_path->copy_src_path = apr_pstrdup(pool, copy_path);
}
/* Cache the node we found (if it wasn't already cached). */
if (! cached_node)
- SVN_ERR(dag_node_cache_set(root, path_so_far, child, pool));
+ SVN_ERR(dag_node_cache_set(root, path_so_far, child, iterpool));
}
/* Are we finished traversing the path? */
@@ -692,13 +695,14 @@ 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, pool),
- apr_psprintf(pool, _("Failure opening '%s'"), path));
+ SVN_ERR_W(SVN_FS__ERR_NOT_DIRECTORY(fs, path_so_far, iterpool),
+ apr_psprintf(iterpool, _("Failure opening '%s'"), path));
rest = next;
here = child;
}
+ svn_pool_destroy(iterpool);
*parent_path_p = parent_path;
return SVN_NO_ERROR;
}
@@ -763,7 +767,7 @@ make_path_mutable(svn_fs_root_t *root,
/* Determine what copyroot our new child node should use. */
SVN_ERR(svn_fs_fs__dag_get_copyroot(©root_rev, ©root_path,
- parent_path->node, pool));
+ parent_path->node));
SVN_ERR(svn_fs_fs__revision_root(©root_root, root->fs,
copyroot_rev, pool));
SVN_ERR(get_dag(©root_node, copyroot_root, copyroot_path, pool));
@@ -1114,8 +1118,7 @@ fs_change_node_prop(svn_fs_root_t *root,
{
apr_int64_t increment = 0;
svn_boolean_t had_mergeinfo;
- SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&had_mergeinfo, parent_path->node,
- pool));
+ SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&had_mergeinfo, parent_path->node));
if (value && !had_mergeinfo)
increment = 1;
@@ -1169,7 +1172,7 @@ fs_props_changed(svn_boolean_t *changed_
SVN_ERR(get_dag(&node1, root1, path1, pool));
SVN_ERR(get_dag(&node2, root2, path2, pool));
return svn_fs_fs__dag_things_different(changed_p, NULL,
- node1, node2, pool);
+ node1, node2);
}
@@ -1379,9 +1382,9 @@ merge(svn_stringbuf_t *conflict_p,
/* ### todo: it would be more efficient to simply check for a NULL
entries hash where necessary below than to allocate an empty hash
here, but another day, another day... */
- SVN_ERR(svn_fs_fs__dag_dir_entries(&s_entries, source, pool, pool));
- SVN_ERR(svn_fs_fs__dag_dir_entries(&t_entries, target, pool, pool));
- SVN_ERR(svn_fs_fs__dag_dir_entries(&a_entries, ancestor, pool, pool));
+ SVN_ERR(svn_fs_fs__dag_dir_entries(&s_entries, source, pool));
+ SVN_ERR(svn_fs_fs__dag_dir_entries(&t_entries, target, pool));
+ SVN_ERR(svn_fs_fs__dag_dir_entries(&a_entries, ancestor, pool));
/* for each entry E in a_entries... */
iterpool = svn_pool_create(pool);
@@ -1418,8 +1421,7 @@ merge(svn_stringbuf_t *conflict_p,
{
apr_int64_t mergeinfo_start;
SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_start,
- t_ent_node,
- iterpool));
+ t_ent_node));
mergeinfo_increment -= mergeinfo_start;
}
@@ -1433,8 +1435,7 @@ merge(svn_stringbuf_t *conflict_p,
{
apr_int64_t mergeinfo_end;
SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_end,
- s_ent_node,
- iterpool));
+ s_ent_node));
mergeinfo_increment += mergeinfo_end;
}
@@ -1547,8 +1548,7 @@ merge(svn_stringbuf_t *conflict_p,
{
apr_int64_t mergeinfo_s;
SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_s,
- s_ent_node,
- iterpool));
+ s_ent_node));
mergeinfo_increment += mergeinfo_s;
}
@@ -1845,7 +1845,7 @@ fs_dir_entries(apr_hash_t **table_p,
/* Get the entries for this path in the caller's pool. */
SVN_ERR(get_dag(&node, root, path, pool));
- return svn_fs_fs__dag_dir_entries(table_p, node, pool, pool);
+ return svn_fs_fs__dag_dir_entries(table_p, node, pool);
}
@@ -1931,8 +1931,7 @@ fs_delete_node(svn_fs_root_t *root,
SVN_ERR(make_path_mutable(root, parent_path->parent, path, pool));
if (svn_fs_fs__fs_supports_mergeinfo(root->fs))
SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_count,
- parent_path->node,
- pool));
+ parent_path->node));
SVN_ERR(svn_fs_fs__dag_delete(parent_path->parent->node,
parent_path->entry,
txn_id, pool));
@@ -2047,8 +2046,7 @@ copy_helper(svn_fs_root_t *from_root,
kind = svn_fs_path_change_replace;
if (svn_fs_fs__fs_supports_mergeinfo(to_root->fs))
SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_start,
- to_parent_path->node,
- pool));
+ to_parent_path->node));
}
else
{
@@ -2058,7 +2056,7 @@ copy_helper(svn_fs_root_t *from_root,
if (svn_fs_fs__fs_supports_mergeinfo(to_root->fs))
SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_end,
- from_node, pool));
+ from_node));
/* Make sure the target node's parents are mutable. */
SVN_ERR(make_path_mutable(to_root, to_parent_path->parent,
@@ -2191,8 +2189,8 @@ fs_copied_from(svn_revnum_t *rev_p,
/* There is no cached entry, look it up the old-fashioned
way. */
SVN_ERR(get_dag(&node, root, path, pool));
- SVN_ERR(svn_fs_fs__dag_get_copyfrom_rev(©from_rev, node, pool));
- SVN_ERR(svn_fs_fs__dag_get_copyfrom_path(©from_path, node, pool));
+ SVN_ERR(svn_fs_fs__dag_get_copyfrom_rev(©from_rev, node));
+ SVN_ERR(svn_fs_fs__dag_get_copyfrom_path(©from_path, node));
}
*rev_p = copyfrom_rev;
@@ -2702,7 +2700,7 @@ fs_contents_changed(svn_boolean_t *chang
SVN_ERR(get_dag(&node1, root1, path1, pool));
SVN_ERR(get_dag(&node2, root2, path2, pool));
return svn_fs_fs__dag_things_different(NULL, changed_p,
- node1, node2, pool);
+ node1, node2);
}
@@ -2834,7 +2832,7 @@ find_youngest_copyroot(svn_revnum_t *rev
/* Find our copyroot. */
SVN_ERR(svn_fs_fs__dag_get_copyroot(&rev_mine, &path_mine,
- parent_path->node, pool));
+ parent_path->node));
/* If a parent and child were copied to in the same revision, prefer
the child copy target, since it is the copy relevant to the
@@ -2914,7 +2912,7 @@ static svn_error_t *fs_closest_copy(svn_
if (created_rev == copy_dst_rev)
{
const svn_fs_id_t *pred;
- SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred, copy_dst_node, pool));
+ SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred, copy_dst_node));
if (! pred)
return SVN_NO_ERROR;
}
@@ -3075,7 +3073,7 @@ fs_node_origin_rev(svn_revnum_t *revisio
value cached in the node (which is allocated in
SUBPOOL... maybe). */
svn_pool_clear(predidpool);
- SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node, subpool));
+ SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node));
pred_id = pred_id ? svn_fs_fs__id_copy(pred_id, predidpool) : NULL;
}
while (pred_id);
@@ -3177,7 +3175,7 @@ history_prev(void *baton, apr_pool_t *po
no predecessor, in which case we're all done!). */
const svn_fs_id_t *pred_id;
- SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node, pool));
+ SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node));
if (! pred_id)
return SVN_NO_ERROR;
@@ -3225,8 +3223,8 @@ history_prev(void *baton, apr_pool_t *po
/* If we get here, then our current path is the destination
of, or the child of the destination of, a copy. Fill
in the return values and get outta here. */
- SVN_ERR(svn_fs_fs__dag_get_copyfrom_rev(&src_rev, node, pool));
- SVN_ERR(svn_fs_fs__dag_get_copyfrom_path(©_src, node, pool));
+ SVN_ERR(svn_fs_fs__dag_get_copyfrom_rev(&src_rev, node));
+ SVN_ERR(svn_fs_fs__dag_get_copyfrom_path(©_src, node));
dst_rev = copyroot_rev;
src_path = svn_fspath__join(copy_src, remainder_path, pool);
@@ -3390,7 +3388,7 @@ crawl_directory_dag_for_mergeinfo(svn_fs
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
SVN_ERR(svn_fs_fs__dag_dir_entries(&entries, dir_dag,
- scratch_pool, scratch_pool));
+ scratch_pool));
for (hi = apr_hash_first(scratch_pool, entries);
hi;
@@ -3406,9 +3404,8 @@ crawl_directory_dag_for_mergeinfo(svn_fs
kid_path = svn_fspath__join(this_path, dirent->name, iterpool);
SVN_ERR(get_dag(&kid_dag, root, kid_path, iterpool));
- SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&has_mergeinfo, kid_dag, iterpool));
- SVN_ERR(svn_fs_fs__dag_has_descendants_with_mergeinfo(&go_down, kid_dag,
- iterpool));
+ SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&has_mergeinfo, kid_dag));
+ SVN_ERR(svn_fs_fs__dag_has_descendants_with_mergeinfo(&go_down, kid_dag));
if (has_mergeinfo)
{
@@ -3483,7 +3480,6 @@ get_mergeinfo_for_path(svn_mergeinfo_t *
parent_path_t *parent_path, *nearest_ancestor;
apr_hash_t *proplist;
svn_string_t *mergeinfo_string;
- apr_pool_t *iterpool = svn_pool_create(scratch_pool);
*mergeinfo = NULL;
@@ -3503,17 +3499,14 @@ get_mergeinfo_for_path(svn_mergeinfo_t *
{
svn_boolean_t has_mergeinfo;
- svn_pool_clear(iterpool);
-
SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&has_mergeinfo,
- nearest_ancestor->node, iterpool));
+ nearest_ancestor->node));
if (has_mergeinfo)
break;
/* No need to loop if we're looking for explicit mergeinfo. */
if (inherit == svn_mergeinfo_explicit)
{
- svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
@@ -3522,13 +3515,10 @@ get_mergeinfo_for_path(svn_mergeinfo_t *
/* Run out? There's no mergeinfo. */
if (!nearest_ancestor)
{
- svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
}
- svn_pool_destroy(iterpool);
-
SVN_ERR(svn_fs_fs__dag_get_proplist(&proplist, nearest_ancestor->node,
scratch_pool));
mergeinfo_string = apr_hash_get(proplist, SVN_PROP_MERGEINFO,
@@ -3596,8 +3586,7 @@ add_descendant_mergeinfo(svn_mergeinfo_c
SVN_ERR(get_dag(&this_dag, root, path, scratch_pool));
SVN_ERR(svn_fs_fs__dag_has_descendants_with_mergeinfo(&go_down,
- this_dag,
- scratch_pool));
+ this_dag));
if (go_down)
SVN_ERR(crawl_directory_dag_for_mergeinfo(root,
path,
@@ -3812,3 +3801,169 @@ make_txn_root(svn_fs_root_t **root_p,
*root_p = root;
return SVN_NO_ERROR;
}
+
+
+
+/* Verify. */
+static APR_INLINE const char *
+stringify_node(dag_node_t *node,
+ apr_pool_t *pool)
+{
+ /* ### TODO: print some PATH@REV to it, too. */
+ return svn_fs_fs__id_unparse(svn_fs_fs__dag_get_id(node), pool)->data;
+}
+
+/* Check metadata sanity on NODE, and on its children. Manually verify
+ information for DAG nodes in revision REV, and trust the metadata
+ accuracy for nodes belonging to older revisions. */
+static svn_error_t *
+verify_node(dag_node_t *node,
+ svn_revnum_t rev,
+ apr_pool_t *pool)
+{
+ svn_boolean_t has_mergeinfo;
+ apr_int64_t mergeinfo_count;
+ const svn_fs_id_t *pred_id;
+ svn_fs_t *fs = svn_fs_fs__dag_get_fs(node);
+ int pred_count;
+ svn_node_kind_t kind;
+ apr_pool_t *iterpool = svn_pool_create(pool);
+
+ /* Fetch some data. */
+ SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&has_mergeinfo, node));
+ SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_count, node));
+ SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node));
+ SVN_ERR(svn_fs_fs__dag_get_predecessor_count(&pred_count, node));
+ kind = svn_fs_fs__dag_node_kind(node);
+
+ /* Sanity check. */
+ if (mergeinfo_count < 0)
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ "Negative mergeinfo-count %" APR_INT64_T_FMT
+ " on node '%s'",
+ mergeinfo_count, stringify_node(node, iterpool));
+
+ /* Issue #4129. (This check will explicitly catch non-root instances too.) */
+ if (pred_id)
+ {
+ dag_node_t *pred;
+ int pred_pred_count;
+ SVN_ERR(svn_fs_fs__dag_get_node(&pred, fs, pred_id, iterpool));
+ SVN_ERR(svn_fs_fs__dag_get_predecessor_count(&pred_pred_count, pred));
+ if (pred_pred_count+1 != pred_count)
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ "Predecessor count mismatch: "
+ "%s has %d, but %s has %d",
+ stringify_node(node, iterpool), pred_count,
+ stringify_node(pred, iterpool), pred_pred_count);
+ }
+
+ /* Kind-dependent verifications. */
+ if (kind == svn_node_none)
+ {
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ "Node '%s' has kind 'none'",
+ stringify_node(node, iterpool));
+ }
+ if (kind == svn_node_file)
+ {
+ if (has_mergeinfo != mergeinfo_count) /* comparing int to bool */
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ "File node '%s' has inconsistent mergeinfo: "
+ "has_mergeinfo=%d, "
+ "mergeinfo_count=%" APR_INT64_T_FMT,
+ stringify_node(node, iterpool),
+ has_mergeinfo, mergeinfo_count);
+ }
+ if (kind == svn_node_dir)
+ {
+ apr_hash_t *entries;
+ apr_hash_index_t *hi;
+ apr_int64_t children_mergeinfo = 0;
+
+ SVN_ERR(svn_fs_fs__dag_dir_entries(&entries, node, pool));
+
+ /* Compute CHILDREN_MERGEINFO. */
+ for (hi = apr_hash_first(pool, entries);
+ hi;
+ hi = apr_hash_next(hi))
+ {
+ svn_fs_dirent_t *dirent = svn__apr_hash_index_val(hi);
+ dag_node_t *child;
+ svn_revnum_t child_rev;
+ apr_int64_t child_mergeinfo;
+
+ svn_pool_clear(iterpool);
+
+ /* Compute CHILD_REV. */
+ SVN_ERR(svn_fs_fs__dag_get_node(&child, fs, dirent->id, iterpool));
+ SVN_ERR(svn_fs_fs__dag_get_revision(&child_rev, child, iterpool));
+
+ if (child_rev == rev)
+ SVN_ERR(verify_node(child, rev, iterpool));
+
+ SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&child_mergeinfo, child));
+ children_mergeinfo += child_mergeinfo;
+ }
+
+ /* Side-effect of issue #4129. */
+ if (children_mergeinfo+has_mergeinfo != mergeinfo_count)
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ "Mergeinfo-count discrepancy on '%s': "
+ "expected %" APR_INT64_T_FMT "+%d, "
+ "counted %" APR_INT64_T_FMT,
+ stringify_node(node, iterpool),
+ mergeinfo_count, has_mergeinfo,
+ children_mergeinfo);
+ }
+
+ svn_pool_destroy(iterpool);
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_fs_fs__verify_root(svn_fs_root_t *root,
+ apr_pool_t *pool)
+{
+ fs_rev_root_data_t *frd;
+
+ if (root->is_txn_root)
+ /* ### Not implemented */
+ return SVN_NO_ERROR;
+ frd = root->fsap_data;
+
+ /* Recursively verify ROOT_DIR. */
+ SVN_ERR(verify_node(frd->root_dir, root->rev, pool));
+
+ /* Verify explicitly the predecessor of the root. */
+ {
+ const svn_fs_id_t *pred_id;
+ dag_node_t *pred;
+ svn_revnum_t pred_rev;
+
+ /* Only r0 should have no predecessor. */
+ SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, frd->root_dir));
+ if (!!pred_id != !!root->rev)
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ "r%ld's root node's predecessor is "
+ "unexpectedly '%s'",
+ root->rev,
+ (pred_id
+ ? svn_fs_fs__id_unparse(pred_id, pool)->data
+ : "(null)"));
+
+ /* Check the predecessor's revision. */
+ if (pred_id)
+ {
+ SVN_ERR(svn_fs_fs__dag_get_node(&pred, root->fs, pred_id, pool));
+ SVN_ERR(svn_fs_fs__dag_get_revision(&pred_rev, pred, pool));
+ if (pred_rev+1 != root->rev)
+ /* Issue #4129. */
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ "r%ld's root node's predecessor is r%ld",
+ root->rev, pred_rev);
+ }
+ }
+
+ return SVN_NO_ERROR;
+}
Modified: subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.h?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.h (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_fs_fs/tree.h Mon Mar 26 23:23:46 2012
@@ -78,6 +78,12 @@ svn_fs_fs__node_created_rev(svn_revnum_t
const char *path,
apr_pool_t *pool);
+/* Verify metadata for ROOT.
+ ### Currently only implemented for revision roots. */
+svn_error_t *
+svn_fs_fs__verify_root(svn_fs_root_t *root,
+ apr_pool_t *pool);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/blame.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/blame.c Mon Mar 26 23:23:46 2012
@@ -141,6 +141,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
return parser->state->private;
}
+
static const svn_string_t *
create_propval(blame_info_t *info)
{
@@ -149,6 +150,9 @@ create_propval(blame_info_t *info)
const svn_string_t *morph;
morph = svn_stringbuf__morph_into_string(info->prop_value);
+#ifdef SVN_DEBUG
+ info->prop_value = NULL; /* morph killed the stringbuf. */
+#endif
return svn_base64_decode_string(morph, info->pool);
}
@@ -157,11 +161,11 @@ create_propval(blame_info_t *info)
static svn_error_t *
start_blame(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- blame_context_t *blame_ctx = userData;
+ blame_context_t *blame_ctx = parser->user_data;
blame_state_e state;
state = parser->state->current_state;
@@ -253,10 +257,10 @@ start_blame(svn_ra_serf__xml_parser_t *p
static svn_error_t *
end_blame(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- blame_context_t *blame_ctx = userData;
+ blame_context_t *blame_ctx = parser->user_data;
blame_state_e state;
blame_info_t *info;
@@ -325,11 +329,11 @@ end_blame(svn_ra_serf__xml_parser_t *par
static svn_error_t *
cdata_blame(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- blame_context_t *blame_ctx = userData;
+ blame_context_t *blame_ctx = parser->user_data;
blame_state_e state;
blame_info_t *info;
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/get_deleted_rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/get_deleted_rev.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/get_deleted_rev.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/get_deleted_rev.c Mon Mar 26 23:23:46 2012
@@ -70,11 +70,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
static svn_error_t *
start_getdrev(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- drev_context_t *drev_ctx = userData;
+ drev_context_t *drev_ctx = parser->user_data;
drev_state_e state;
state = parser->state->current_state;
@@ -90,10 +90,10 @@ start_getdrev(svn_ra_serf__xml_parser_t
static svn_error_t *
end_getdrev(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- drev_context_t *drev_ctx = userData;
+ drev_context_t *drev_ctx = parser->user_data;
drev_state_e state;
svn_string_t *info;
@@ -113,11 +113,11 @@ end_getdrev(svn_ra_serf__xml_parser_t *p
static svn_error_t *
cdata_getdrev(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- drev_context_t *drev_ctx = userData;
+ drev_context_t *drev_ctx = parser->user_data;
drev_state_e state;
UNUSED_CTX(drev_ctx);
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getdate.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getdate.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getdate.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getdate.c Mon Mar 26 23:23:46 2012
@@ -67,11 +67,11 @@ typedef struct date_context_t {
static svn_error_t *
start_getdate(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- date_context_t *date_ctx = userData;
+ date_context_t *date_ctx = parser->user_data;
date_state_e state = parser->state->current_state;
UNUSED_CTX(date_ctx);
@@ -89,10 +89,10 @@ start_getdate(svn_ra_serf__xml_parser_t
static svn_error_t *
end_getdate(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- date_context_t *date_ctx = userData;
+ date_context_t *date_ctx = parser->user_data;
date_state_e state = parser->state->current_state;
if (state == VERSION_NAME &&
@@ -109,11 +109,11 @@ end_getdate(svn_ra_serf__xml_parser_t *p
static svn_error_t *
cdata_getdate(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- date_context_t *date_ctx = userData;
+ date_context_t *date_ctx = parser->user_data;
date_state_e state = parser->state->current_state;
svn_stringbuf_t *datebuf;
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocations.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocations.c Mon Mar 26 23:23:46 2012
@@ -109,11 +109,11 @@ static void pop_state(loc_context_t *loc
static svn_error_t *
start_getloc(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- loc_context_t *loc_ctx = userData;
+ loc_context_t *loc_ctx = parser->user_data;
if (!loc_ctx->state && strcmp(name.name, "get-locations-report") == 0)
{
@@ -148,10 +148,10 @@ start_getloc(svn_ra_serf__xml_parser_t *
static svn_error_t *
end_getloc(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- loc_context_t *loc_ctx = userData;
+ loc_context_t *loc_ctx = parser->user_data;
loc_state_list_t *cur_state;
if (!loc_ctx->state)
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocationsegments.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocationsegments.c Mon Mar 26 23:23:46 2012
@@ -64,11 +64,11 @@ typedef struct gls_context_t {
static svn_error_t *
start_gls(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- gls_context_t *gls_ctx = userData;
+ gls_context_t *gls_ctx = parser->user_data;
if ((! gls_ctx->inside_report)
&& strcmp(name.name, "get-location-segments-report") == 0)
@@ -115,10 +115,10 @@ start_gls(svn_ra_serf__xml_parser_t *par
static svn_error_t *
end_gls(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- gls_context_t *gls_ctx = userData;
+ gls_context_t *gls_ctx = parser->user_data;
if (strcmp(name.name, "get-location-segments-report") == 0)
gls_ctx->inside_report = FALSE;
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocks.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocks.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocks.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/getlocks.c Mon Mar 26 23:23:46 2012
@@ -110,11 +110,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
static svn_error_t *
start_getlocks(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- lock_context_t *lock_ctx = userData;
+ lock_context_t *lock_ctx = parser->user_data;
lock_state_e state;
state = parser->state->current_state;
@@ -162,10 +162,10 @@ start_getlocks(svn_ra_serf__xml_parser_t
static svn_error_t *
end_getlocks(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- lock_context_t *lock_ctx = userData;
+ lock_context_t *lock_ctx = parser->user_data;
lock_state_e state;
lock_info_t *info;
@@ -263,11 +263,11 @@ end_getlocks(svn_ra_serf__xml_parser_t *
static svn_error_t *
cdata_getlocks(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- lock_context_t *lock_ctx = userData;
+ lock_context_t *lock_ctx = parser->user_data;
lock_state_e state;
lock_info_t *info;
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/locks.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/locks.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/locks.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/locks.c Mon Mar 26 23:23:46 2012
@@ -74,10 +74,6 @@ typedef struct lock_info_t {
int status_code;
const char *reason;
- /* The currently collected value as we build it up */
- const char *tmp;
- apr_size_t tmp_len;
-
/* are we done? */
svn_boolean_t done;
} lock_info_t;
@@ -112,11 +108,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
*/
static svn_error_t *
start_lock(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- lock_info_t *ctx = userData;
+ lock_info_t *ctx = parser->user_data;
lock_state_e state;
state = parser->state->current_state;
@@ -193,10 +189,10 @@ start_lock(svn_ra_serf__xml_parser_t *pa
*/
static svn_error_t *
end_lock(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- lock_info_t *ctx = userData;
+ lock_info_t *ctx = parser->user_data;
lock_state_e state;
state = parser->state->current_state;
@@ -278,11 +274,11 @@ end_lock(svn_ra_serf__xml_parser_t *pars
static svn_error_t *
cdata_lock(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- lock_info_t *lock_ctx = userData;
+ lock_info_t *lock_ctx = parser->user_data;
lock_state_e state;
svn_stringbuf_t *info;
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/log.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/log.c Mon Mar 26 23:23:46 2012
@@ -190,11 +190,11 @@ read_changed_path_attributes(svn_log_cha
static svn_error_t *
start_log(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- log_context_t *log_ctx = userData;
+ log_context_t *log_ctx = parser->user_data;
log_state_e state;
state = parser->state->current_state;
@@ -325,9 +325,12 @@ maybe_decode_log_cdata(const svn_string_
if (info->tmp_encoding)
{
- const svn_string_t *morph;
+ svn_string_t tmp;
- morph = svn_stringbuf__morph_into_string(info->tmp);
+ /* Don't use morph_info_string cuz we need info->tmp to
+ remain usable. */
+ tmp.data = info->tmp->data;
+ tmp.len = info->tmp->len;
/* Check for a known encoding type. This is easy -- there's
only one. */
@@ -338,7 +341,7 @@ maybe_decode_log_cdata(const svn_string_
info->tmp_encoding);
}
- *decoded_cdata = svn_base64_decode_string(morph, info->pool);
+ *decoded_cdata = svn_base64_decode_string(&tmp, info->pool);
}
else
{
@@ -349,10 +352,10 @@ maybe_decode_log_cdata(const svn_string_
static svn_error_t *
end_log(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- log_context_t *log_ctx = userData;
+ log_context_t *log_ctx = parser->user_data;
log_state_e state;
log_info_t *info;
@@ -482,11 +485,11 @@ end_log(svn_ra_serf__xml_parser_t *parse
static svn_error_t *
cdata_log(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- log_context_t *log_ctx = userData;
+ log_context_t *log_ctx = parser->user_data;
log_state_e state;
log_info_t *info;
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/merge.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/merge.c Mon Mar 26 23:23:46 2012
@@ -129,11 +129,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
static svn_error_t *
start_merge(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__merge_context_t *ctx = userData;
+ svn_ra_serf__merge_context_t *ctx = parser->user_data;
merge_state_e state;
merge_info_t *info;
@@ -235,10 +235,10 @@ start_merge(svn_ra_serf__xml_parser_t *p
static svn_error_t *
end_merge(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__merge_context_t *ctx = userData;
+ svn_ra_serf__merge_context_t *ctx = parser->user_data;
merge_state_e state;
merge_info_t *info;
@@ -376,11 +376,11 @@ end_merge(svn_ra_serf__xml_parser_t *par
static svn_error_t *
cdata_merge(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__merge_context_t *ctx = userData;
+ svn_ra_serf__merge_context_t *ctx = parser->user_data;
merge_state_e state;
merge_info_t *info;
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/mergeinfo.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/mergeinfo.c Mon Mar 26 23:23:46 2012
@@ -66,11 +66,11 @@ typedef struct mergeinfo_context_t {
static svn_error_t *
start_element(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- mergeinfo_context_t *mergeinfo_ctx = userData;
+ mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
mergeinfo_state_e state;
state = parser->state->current_state;
@@ -99,10 +99,11 @@ start_element(svn_ra_serf__xml_parser_t
}
static svn_error_t *
-end_element(svn_ra_serf__xml_parser_t *parser, void *userData,
- svn_ra_serf__dav_props_t name)
+end_element(svn_ra_serf__xml_parser_t *parser,
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- mergeinfo_context_t *mergeinfo_ctx = userData;
+ mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
mergeinfo_state_e state;
state = parser->state->current_state;
@@ -149,10 +150,12 @@ end_element(svn_ra_serf__xml_parser_t *p
static svn_error_t *
-cdata_handler(svn_ra_serf__xml_parser_t *parser, void *userData,
- const char *data, apr_size_t len)
+cdata_handler(svn_ra_serf__xml_parser_t *parser,
+ const char *data,
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- mergeinfo_context_t *mergeinfo_ctx = userData;
+ mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
mergeinfo_state_e state;
state = parser->state->current_state;
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/options.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/options.c Mon Mar 26 23:23:46 2012
@@ -127,11 +127,11 @@ static void pop_state(svn_ra_serf__optio
static svn_error_t *
start_options(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__options_context_t *options_ctx = userData;
+ svn_ra_serf__options_context_t *options_ctx = parser->user_data;
if (!options_ctx->state && strcmp(name.name, "options-response") == 0)
{
@@ -159,10 +159,10 @@ start_options(svn_ra_serf__xml_parser_t
static svn_error_t *
end_options(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__options_context_t *options_ctx = userData;
+ svn_ra_serf__options_context_t *options_ctx = parser->user_data;
options_state_list_t *cur_state;
if (!options_ctx->state)
@@ -196,11 +196,11 @@ end_options(svn_ra_serf__xml_parser_t *p
static svn_error_t *
cdata_options(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__options_context_t *ctx = userData;
+ svn_ra_serf__options_context_t *ctx = parser->user_data;
if (ctx->collect_cdata)
svn_stringbuf_appendbytes(ctx->acbuf, data, len);
Modified: subversion/branches/inheritable-props/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_ra_serf/property.c?rev=1305667&r1=1305666&r2=1305667&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_ra_serf/property.c Mon Mar 26 23:23:46 2012
@@ -254,11 +254,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
*/
static svn_error_t *
start_propfind(svn_ra_serf__xml_parser_t *parser,
- void *userData,
svn_ra_serf__dav_props_t name,
- const char **attrs)
+ const char **attrs,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__propfind_context_t *ctx = userData;
+ svn_ra_serf__propfind_context_t *ctx = parser->user_data;
prop_state_e state;
prop_info_t *info;
@@ -295,10 +295,10 @@ start_propfind(svn_ra_serf__xml_parser_t
*/
static svn_error_t *
end_propfind(svn_ra_serf__xml_parser_t *parser,
- void *userData,
- svn_ra_serf__dav_props_t name)
+ svn_ra_serf__dav_props_t name,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__propfind_context_t *ctx = userData;
+ svn_ra_serf__propfind_context_t *ctx = parser->user_data;
prop_state_e state;
prop_info_t *info;
@@ -351,6 +351,9 @@ end_propfind(svn_ra_serf__xml_parser_t *
const svn_string_t *morph;
morph = svn_stringbuf__morph_into_string(info->value);
+#ifdef SVN_DEBUG
+ info->value = NULL; /* morph killed the stringbuf. */
+#endif
val_str = svn_base64_decode_string(morph, ctx->pool);
}
else
@@ -389,11 +392,11 @@ end_propfind(svn_ra_serf__xml_parser_t *
*/
static svn_error_t *
cdata_propfind(svn_ra_serf__xml_parser_t *parser,
- void *userData,
const char *data,
- apr_size_t len)
+ apr_size_t len,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__propfind_context_t *ctx = userData;
+ svn_ra_serf__propfind_context_t *ctx = parser->user_data;
prop_state_e state;
prop_info_t *info;