Author: ivan
Date: Mon Oct 26 15:37:49 2015
New Revision: 1710631

URL: http://svn.apache.org/viewvc?rev=1710631&view=rev
Log:
Switch svn_fs_create() to result/scratch pool paradigm.

* subversion/include/svn_fs.h
  (svn_fs_create2): Revv svn_fs_create() with SCRATCH_POOL argument.
  (svn_fs_create): Deprecate.

* subversion/libsvn_fs/fs-loader.c
  (svn_fs_create2): Revv. Use SCRATCH_POOL for temporary allocations instead
   of creating new subpool.
  (svn_fs_create): Implement deprecated function.

* subversion/libsvn_repos/repos.c
  (svn_repos_create): Use svn_fs_create2().

* subversion/tests/svn_test_fs.c
  (create_fs): Use svn_fs_create2().

Modified:
    subversion/trunk/subversion/include/svn_fs.h
    subversion/trunk/subversion/libsvn_fs/fs-loader.c
    subversion/trunk/subversion/libsvn_repos/repos.c
    subversion/trunk/subversion/tests/svn_test_fs.c

Modified: subversion/trunk/subversion/include/svn_fs.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_fs.h?rev=1710631&r1=1710630&r2=1710631&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_fs.h (original)
+++ subversion/trunk/subversion/include/svn_fs.h Mon Oct 26 15:37:49 2015
@@ -269,11 +269,13 @@ svn_fs_set_warning_func(svn_fs_t *fs,
  * @c NULL, the options it contains modify the behavior of the
  * filesystem.  The interpretation of @a fs_config is specific to the
  * filesystem back-end.  The new filesystem may be closed by
- * destroying @a pool.
+ * destroying @a result_pool.
+ *
+ * Use @a scratch_pool for temporary allocations.
  *
  * @note The lifetime of @a fs_config must not be shorter than @a
- * pool's. It's a good idea to allocate @a fs_config from @a pool or
- * one of its ancestors.
+ * result_pool's. It's a good idea to allocate @a fs_config from
+ * @a result_pool or one of its ancestors.
  *
  * If @a fs_config contains a value for #SVN_FS_CONFIG_FS_TYPE, that
  * value determines the filesystem type for the new filesystem.
@@ -289,8 +291,22 @@ svn_fs_set_warning_func(svn_fs_t *fs,
  * though the caller should not rely upon any particular default if they
  * wish to ensure that a filesystem of a specific type is created.
  *
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_fs_create2(svn_fs_t **fs_p,
+               const char *path,
+               apr_hash_t *fs_config,
+               apr_pool_t *result_pool,
+               apr_pool_t *scratch_pool);
+
+/**
+ * Like svn_fs_create2(), but without @a scratch_pool.
+ *
+ * @deprecated Provided for backward compatibility with the 1.9 API.
  * @since New in 1.1.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_fs_create(svn_fs_t **fs_p,
               const char *path,

Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1710631&r1=1710630&r2=1710631&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Mon Oct 26 15:37:49 2015
@@ -506,11 +506,13 @@ svn_fs_set_warning_func(svn_fs_t *fs, sv
 }
 
 svn_error_t *
-svn_fs_create(svn_fs_t **fs_p, const char *path, apr_hash_t *fs_config,
-              apr_pool_t *pool)
+svn_fs_create2(svn_fs_t **fs_p,
+               const char *path,
+               apr_hash_t *fs_config,
+               apr_pool_t *result_pool,
+               apr_pool_t *scratch_pool)
 {
   fs_library_vtable_t *vtable;
-  apr_pool_t *scratch_pool = svn_pool_create(pool);
 
   const char *fs_type = svn_hash__get_cstring(fs_config,
                                               SVN_FS_CONFIG_FS_TYPE,
@@ -522,17 +524,25 @@ svn_fs_create(svn_fs_t **fs_p, const cha
   SVN_ERR(write_fs_type(path, fs_type, scratch_pool));
 
   /* Perform the actual creation. */
-  *fs_p = fs_new(fs_config, pool);
+  *fs_p = fs_new(fs_config, result_pool);
 
   SVN_ERR(vtable->create(*fs_p, path, common_pool_lock, scratch_pool,
                          common_pool));
   SVN_ERR(vtable->set_svn_fs_open(*fs_p, svn_fs_open2));
 
-  svn_pool_destroy(scratch_pool);
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
+svn_fs_create(svn_fs_t **fs_p,
+              const char *path,
+              apr_hash_t *fs_config,
+              apr_pool_t *pool)
+{
+  return svn_fs_create2(fs_p, path, fs_config, pool, pool);
+}
+
+svn_error_t *
 svn_fs_open2(svn_fs_t **fs_p, const char *path, apr_hash_t *fs_config,
              apr_pool_t *result_pool,
              apr_pool_t *scratch_pool)

Modified: subversion/trunk/subversion/libsvn_repos/repos.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/repos.c?rev=1710631&r1=1710630&r2=1710631&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/repos.c (original)
+++ subversion/trunk/subversion/libsvn_repos/repos.c Mon Oct 26 15:37:49 2015
@@ -1175,8 +1175,8 @@ svn_repos_create(svn_repos_t **repos_p,
   SVN_ERR(lock_repos(repos, FALSE, FALSE, scratch_pool));
 
   /* Create an environment for the filesystem. */
-  if ((err = svn_fs_create(&repos->fs, repos->db_path, fs_config,
-                           result_pool)))
+  if ((err = svn_fs_create2(&repos->fs, repos->db_path, fs_config,
+                            result_pool, scratch_pool)))
     {
       /* If there was an error making the filesytem, e.g. unknown/supported
        * filesystem type.  Clean up after ourselves.  Yes this is safe because

Modified: subversion/trunk/subversion/tests/svn_test_fs.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_fs.c?rev=1710631&r1=1710630&r2=1710631&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_fs.c (original)
+++ subversion/trunk/subversion/tests/svn_test_fs.c Mon Oct 26 15:37:49 2015
@@ -119,7 +119,7 @@ create_fs(svn_fs_t **fs_p,
      runs.  */
   SVN_ERR(svn_io_remove_dir2(name, TRUE, NULL, NULL, pool));
 
-  SVN_ERR(svn_fs_create(fs_p, name, fs_config, pool));
+  SVN_ERR(svn_fs_create2(fs_p, name, fs_config, pool, pool));
   if (! *fs_p)
     return svn_error_create(SVN_ERR_FS_GENERAL, NULL,
                             "Couldn't alloc a new fs object.");


Reply via email to