Author: stefan2
Date: Tue Jan 13 00:03:45 2015
New Revision: 1651239
URL: http://svn.apache.org/r1651239
Log:
Gone through FSX/util.* and identified the functions that construct their
return value without the need of temporaries. Name their pool parameters
result_pool as per our two pool paradigm. One of the functions is being
declared in another header; fix it there.
* subversion/libsvn_fs_x/util.h
(svn_fs_x__path_format,
svn_fs_x__path_uuid,
svn_fs_x__path_txn_current,
svn_fs_x__path_txn_current_lock,
svn_fs_x__path_lock,
svn_fs_x__path_pack_lock,
svn_fs_x__path_revprop_generation,
svn_fs_x__txn_name,
svn_fs_x__path_txns_dir,
svn_fs_x__path_txn_proto_revs,
svn_fs_x__path_min_unpacked_rev,
svn_fs_x__try_stringbuf_from_file): The POOL is a pure RESULT_POOL.
* subversion/libsvn_fs_x/fs_x.h
(svn_fs_x__path_current): Same. This declaration ought to be moved.
* subversion/libsvn_fs_x/util.c
(svn_fs_x__path_format,
svn_fs_x__path_uuid,
svn_fs_x__path_current,
svn_fs_x__path_txn_current,
svn_fs_x__path_txn_current_lock,
svn_fs_x__path_lock,
svn_fs_x__path_pack_lock,
svn_fs_x__path_revprop_generation,
svn_fs_x__txn_name,
svn_fs_x__path_txns_dir,
svn_fs_x__path_min_unpacked_rev,
svn_fs_x__path_txn_proto_revs,
svn_fs_x__write_current): Same.
svn_fs_x__try_stringbuf_from_file): And here. Remove redundant docstring.
Modified:
subversion/trunk/subversion/libsvn_fs_x/fs_x.h
subversion/trunk/subversion/libsvn_fs_x/util.c
subversion/trunk/subversion/libsvn_fs_x/util.h
Modified: subversion/trunk/subversion/libsvn_fs_x/fs_x.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_x.h?rev=1651239&r1=1651238&r2=1651239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.h Tue Jan 13 00:03:45 2015
@@ -174,10 +174,10 @@ svn_fs_x__path_rev_absolute(svn_fs_t *fs
apr_pool_t *pool);
/* Return the path to the 'current' file in FS.
- Perform allocation in POOL. */
+ Perform allocation in RESULT_POOL. */
const char *
svn_fs_x__path_current(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Read the format number and maximum number of files per directory
from PATH and return them in *PFORMAT and *MAX_FILES_PER_DIR
Modified: subversion/trunk/subversion/libsvn_fs_x/util.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.c?rev=1651239&r1=1651238&r2=1651239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.c Tue Jan 13 00:03:45 2015
@@ -89,52 +89,60 @@ svn_fs_x__pack_size(svn_fs_t *fs, svn_re
}
const char *
-svn_fs_x__path_format(svn_fs_t *fs, apr_pool_t *pool)
+svn_fs_x__path_format(svn_fs_t *fs,
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_FORMAT, pool);
+ return svn_dirent_join(fs->path, PATH_FORMAT, result_pool);
}
const char *
-svn_fs_x__path_uuid(svn_fs_t *fs, apr_pool_t *pool)
+svn_fs_x__path_uuid(svn_fs_t *fs,
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_UUID, pool);
+ return svn_dirent_join(fs->path, PATH_UUID, result_pool);
}
const char *
-svn_fs_x__path_current(svn_fs_t *fs, apr_pool_t *pool)
+svn_fs_x__path_current(svn_fs_t *fs,
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_CURRENT, pool);
+ return svn_dirent_join(fs->path, PATH_CURRENT, result_pool);
}
const char *
-svn_fs_x__path_txn_current(svn_fs_t *fs, apr_pool_t *pool)
+svn_fs_x__path_txn_current(svn_fs_t *fs,
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_TXN_CURRENT, pool);
+ return svn_dirent_join(fs->path, PATH_TXN_CURRENT,
+ result_pool);
}
const char *
-svn_fs_x__path_txn_current_lock(svn_fs_t *fs, apr_pool_t *pool)
+svn_fs_x__path_txn_current_lock(svn_fs_t *fs,
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_TXN_CURRENT_LOCK, pool);
+ return svn_dirent_join(fs->path, PATH_TXN_CURRENT_LOCK, result_pool);
}
const char *
-svn_fs_x__path_lock(svn_fs_t *fs, apr_pool_t *pool)
+svn_fs_x__path_lock(svn_fs_t *fs,
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_LOCK_FILE, pool);
+ return svn_dirent_join(fs->path, PATH_LOCK_FILE, result_pool);
}
const char *
svn_fs_x__path_pack_lock(svn_fs_t *fs,
- apr_pool_t *pool)
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_PACK_LOCK_FILE, pool);
+ return svn_dirent_join(fs->path, PATH_PACK_LOCK_FILE, result_pool);
}
const char *
-svn_fs_x__path_revprop_generation(svn_fs_t *fs, apr_pool_t *pool)
+svn_fs_x__path_revprop_generation(svn_fs_t *fs,
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_REVPROP_GENERATION, pool);
+ return svn_dirent_join(fs->path, PATH_REVPROP_GENERATION, result_pool);
}
const char *
@@ -217,9 +225,9 @@ svn_fs_x__path_revprops(svn_fs_t *fs, sv
const char *
svn_fs_x__txn_name(svn_fs_x__txn_id_t txn_id,
- apr_pool_t *pool)
+ apr_pool_t *result_pool)
{
- char *p = apr_palloc(pool, SVN_INT64_BUFFER_SIZE);
+ char *p = apr_palloc(result_pool, SVN_INT64_BUFFER_SIZE);
svn__ui64tobase36(p, txn_id);
return p;
}
@@ -253,9 +261,9 @@ combine_txn_id_string(svn_fs_x__txn_id_t
const char *
svn_fs_x__path_txns_dir(svn_fs_t *fs,
- apr_pool_t *pool)
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_TXNS_DIR, pool);
+ return svn_dirent_join(fs->path, PATH_TXNS_DIR, result_pool);
}
const char *
@@ -342,16 +350,17 @@ svn_fs_x__path_txn_next_ids(svn_fs_t *fs
}
const char *
-svn_fs_x__path_min_unpacked_rev(svn_fs_t *fs, apr_pool_t *pool)
+svn_fs_x__path_min_unpacked_rev(svn_fs_t *fs,
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_MIN_UNPACKED_REV, pool);
+ return svn_dirent_join(fs->path, PATH_MIN_UNPACKED_REV, result_pool);
}
const char *
svn_fs_x__path_txn_proto_revs(svn_fs_t *fs,
- apr_pool_t *pool)
+ apr_pool_t *result_pool)
{
- return svn_dirent_join(fs->path, PATH_TXN_PROTOS_DIR, pool);
+ return svn_dirent_join(fs->path, PATH_TXN_PROTOS_DIR, result_pool);
}
const char *
@@ -535,24 +544,14 @@ svn_fs_x__write_current(svn_fs_t *fs,
}
-
-/* Read the file at PATH and return its content in *CONTENT. *CONTENT will
- * not be modified unless the whole file was read successfully.
- *
- * ESTALE, EIO and ENOENT will not cause this function to return an error
- * unless LAST_ATTEMPT has been set. If MISSING is not NULL, indicate
- * missing files (ENOENT) there.
- *
- * Use POOL for allocations.
- */
svn_error_t *
svn_fs_x__try_stringbuf_from_file(svn_stringbuf_t **content,
svn_boolean_t *missing,
const char *path,
svn_boolean_t last_attempt,
- apr_pool_t *pool)
+ apr_pool_t *result_pool)
{
- svn_error_t *err = svn_stringbuf_from_file2(content, path, pool);
+ svn_error_t *err = svn_stringbuf_from_file2(content, path, result_pool);
if (missing)
*missing = FALSE;
Modified: subversion/trunk/subversion/libsvn_fs_x/util.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.h?rev=1651239&r1=1651238&r2=1651239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.h Tue Jan 13 00:03:45 2015
@@ -90,53 +90,53 @@ svn_revnum_t
svn_fs_x__pack_size(svn_fs_t *fs, svn_revnum_t rev);
/* Return the full path of the "format" file in FS.
- * The result will be allocated in POOL.
+ * The result will be allocated in RESULT_POOL.
*/
const char *
svn_fs_x__path_format(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Return the full path of the "uuid" file in FS.
- * The result will be allocated in POOL.
+ * The result will be allocated in RESULT_POOL.
*/
const char *
svn_fs_x__path_uuid(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Return the full path of the "txn-current" file in FS.
- * The result will be allocated in POOL.
+ * The result will be allocated in RESULT_POOL.
*/
const char *
svn_fs_x__path_txn_current(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Return the full path of the "txn-current-lock" file in FS.
- * The result will be allocated in POOL.
+ * The result will be allocated in RESULT_POOL.
*/
const char *
svn_fs_x__path_txn_current_lock(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Return the full path of the global write lock file in FS.
- * The result will be allocated in POOL.
+ * The result will be allocated in RESULT_POOL.
*/
const char *
svn_fs_x__path_lock(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Return the full path of the pack operation lock file in FS.
- * The result will be allocated in POOL.
+ * The result will be allocated in RESULT_POOL.
*/
const char *
svn_fs_x__path_pack_lock(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Return the full path of the revprop generation file in FS.
- * Allocate the result in POOL.
+ * Allocate the result in RESULT_POOL.
*/
const char *
svn_fs_x__path_revprop_generation(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Return the path of the pack-related file that for revision REV in FS.
* KIND specifies the file name base, e.g. "pack".
@@ -190,11 +190,11 @@ svn_fs_x__path_revprops(svn_fs_t *fs,
svn_revnum_t rev,
apr_pool_t *pool);
-/* Convert the TXN_ID into a string, allocated from POOL.
+/* Convert the TXN_ID into a string, allocated from RESULT_POOL.
*/
const char *
svn_fs_x__txn_name(svn_fs_x__txn_id_t txn_id,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Convert TXN_NAME into an ID and return it in *TXN_ID. */
svn_error_t *
@@ -210,11 +210,11 @@ svn_fs_x__path_txn_dir(svn_fs_t *fs,
apr_pool_t *pool);
/* Return the path of the 'transactions' directory in FS.
- * The result will be allocated in POOL.
+ * The result will be allocated in RESULT_POOL.
*/
const char *
svn_fs_x__path_txns_dir(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Return the name of the sha1->rep mapping file in transaction TXN_ID
* within FS for the given SHA1 checksum. Use POOL for allocations.
@@ -226,11 +226,11 @@ svn_fs_x__path_txn_sha1(svn_fs_t *fs,
apr_pool_t *pool);
/* Return the path of the 'txn-protorevs' directory in FS, even if that
- * folder may not exist in FS. The result will be allocated in POOL.
+ * folder may not exist in FS. The result will be allocated in RESULT_POOL.
*/
const char *
svn_fs_x__path_txn_proto_revs(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Return the path of the changes file for transaction TXN_ID in FS.
* The result will be allocated in POOL.
@@ -286,11 +286,11 @@ svn_fs_x__path_txn_next_ids(svn_fs_t *fs
apr_pool_t *pool);
/* Return the path of the file storing the oldest non-packed revision in FS.
- * The result will be allocated in POOL.
+ * The result will be allocated in RESULT_POOL.
*/
const char *
svn_fs_x__path_min_unpacked_rev(svn_fs_t *fs,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Return the path of the file containing item_index counter for
* the transaction identified by TXN_ID in FS.
@@ -394,21 +394,20 @@ svn_fs_x__write_current(svn_fs_t *fs,
svn_revnum_t rev,
apr_pool_t *scratch_pool);
-/* Read the file at PATH and return its content in *CONTENT. *CONTENT will
- * not be modified unless the whole file was read successfully.
+/* Read the file at PATH and return its content in *CONTENT, allocated in
+ * RESULT_POOL. *CONTENT will not be modified unless the whole file was
+ * read successfully.
*
* ESTALE, EIO and ENOENT will not cause this function to return an error
* unless LAST_ATTEMPT has been set. If MISSING is not NULL, indicate
* missing files (ENOENT) there.
- *
- * Use POOL for allocations.
*/
svn_error_t *
svn_fs_x__try_stringbuf_from_file(svn_stringbuf_t **content,
svn_boolean_t *missing,
const char *path,
svn_boolean_t last_attempt,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Fetch the current offset of FILE into *OFFSET_P.
* Perform temporary allocations in SCRATCH_POOL. */