You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/01/19 21:38:38 UTC
svn commit: r1653113 - in /subversion/trunk/subversion/libsvn_fs_x: dag.c
transaction.c transaction.h
Author: stefan2
Date: Mon Jan 19 20:38:38 2015
New Revision: 1653113
URL: http://svn.apache.org/r1653113
Log:
Follow-up to r1650960: As it turns out, this function *will* sometimes
allocate memory and store it within the objects passed in.
* subversion/libsvn_fs_x/transaction.h
(svn_fs_x__set_entry): Add the necessary RESULT_POOL and document its usage.
* subversion/libsvn_fs_x/transaction.c
(svn_fs_x__set_entry): Allocate the PARENT directory's DATA_REP on demand
from the RESULT_POOL.
* subversion/libsvn_fs_x/dag.c
(set_entry,
svn_fs_x__dag_delete): Let callers provide the correct result pool.
It is always that one that contains the noderev.
Modified:
subversion/trunk/subversion/libsvn_fs_x/dag.c
subversion/trunk/subversion/libsvn_fs_x/transaction.c
subversion/trunk/subversion/libsvn_fs_x/transaction.h
Modified: subversion/trunk/subversion/libsvn_fs_x/dag.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.c?rev=1653113&r1=1653112&r2=1653113&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.c Mon Jan 19 20:38:38 2015
@@ -408,7 +408,7 @@ set_entry(dag_node_t *parent,
/* Set the new entry. */
return svn_fs_x__set_entry(parent->fs, txn_id, parent_noderev, name, id,
- kind, scratch_pool);
+ kind, parent->node_pool, scratch_pool);
}
@@ -905,7 +905,8 @@ svn_fs_x__dag_delete(dag_node_t *parent,
/* Remove this entry from its parent's entries list. */
return svn_fs_x__set_entry(parent->fs, txn_id, parent_noderev, name,
- NULL, svn_node_unknown, scratch_pool);
+ NULL, svn_node_unknown, parent->node_pool,
+ scratch_pool);
}
Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1653113&r1=1653112&r2=1653113&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Mon Jan 19 20:38:38 2015
@@ -1694,6 +1694,7 @@ svn_fs_x__set_entry(svn_fs_t *fs,
const char *name,
const svn_fs_x__id_t *id,
svn_node_kind_t kind,
+ apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
svn_fs_x__representation_t *rep = parent_noderev->data_rep;
@@ -1721,13 +1722,21 @@ svn_fs_x__set_entry(svn_fs_t *fs,
svn_pool_clear(subpool);
+ /* Provide the parent with a data rep if it had none before
+ (directories so far empty). */
+ if (!rep)
+ {
+ rep = apr_pcalloc(result_pool, sizeof(*rep));
+ parent_noderev->data_rep = rep;
+ }
+
/* Mark the node-rev's data rep as mutable. */
- rep = apr_pcalloc(scratch_pool, sizeof(*rep));
rep->id.change_set = svn_fs_x__change_set_by_txn(txn_id);
rep->id.number = SVN_FS_X__ITEM_INDEX_UNUSED;
- parent_noderev->data_rep = rep;
+
+ /* Save noderev to disk. */
SVN_ERR(svn_fs_x__put_node_revision(fs, parent_noderev, FALSE,
- scratch_pool));
+ subpool));
}
else
{
Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.h?rev=1653113&r1=1653112&r2=1653113&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.h Mon Jan 19 20:38:38 2015
@@ -157,7 +157,11 @@ svn_fs_x__abort_txn(svn_fs_txn_t *txn,
/* Add or set in filesystem FS, transaction TXN_ID, in directory
PARENT_NODEREV a directory entry for NAME pointing to ID of type
- KIND. Temporary allocations are done in SCRATCH_POOL. */
+ KIND. The PARENT_NODEREV's DATA_REP will be redirected to the in-txn
+ representation, if it had not been mutable before.
+
+ If PARENT_NODEREV does not have a DATA_REP, allocate one in RESULT_POOL.
+ Temporary allocations are done in SCRATCH_POOL. */
svn_error_t *
svn_fs_x__set_entry(svn_fs_t *fs,
svn_fs_x__txn_id_t txn_id,
@@ -165,6 +169,7 @@ svn_fs_x__set_entry(svn_fs_t *fs,
const char *name,
const svn_fs_x__id_t *id,
svn_node_kind_t kind,
+ apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Add a change to the changes record for filesystem FS in transaction