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 2016/11/17 14:49:03 UTC

svn commit: r1770201 - in /subversion/branches/authzperf/subversion: include/private/svn_repos_private.h libsvn_repos/config_pool.c svnserve/serve.c svnserve/svnserve.c tests/libsvn_repos/repos-test.c

Author: stefan2
Date: Thu Nov 17 14:49:03 2016
New Revision: 1770201

URL: http://svn.apache.org/viewvc?rev=1770201&view=rev
Log:
On the authzperf branch:
Remove an unused parameter from svn_repos__config_pool_get.

* subversion/include/private/svn_repos_private.h
  (svn_repos__config_pool_get): Remove KEY; it was always NULL now.

* subversion/libsvn_repos/config_pool.c
  (auto_parse,
   find_repos_config): Replace the KEY parameter by a local variable.
  (svn_repos__config_pool_get): Remove KEY.

* subversion/svnserve/serve.c
  (load_pwdb_config,
   find_repos): Update callers.

* subversion/svnserve/svnserve.c
  (sub_main): Same.

* subversion/tests/libsvn_repos/repos-test.c
  (test_config_pool): Same.

Modified:
    subversion/branches/authzperf/subversion/include/private/svn_repos_private.h
    subversion/branches/authzperf/subversion/libsvn_repos/config_pool.c
    subversion/branches/authzperf/subversion/svnserve/serve.c
    subversion/branches/authzperf/subversion/svnserve/svnserve.c
    subversion/branches/authzperf/subversion/tests/libsvn_repos/repos-test.c

Modified: subversion/branches/authzperf/subversion/include/private/svn_repos_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/include/private/svn_repos_private.h?rev=1770201&r1=1770200&r2=1770201&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/include/private/svn_repos_private.h (original)
+++ subversion/branches/authzperf/subversion/include/private/svn_repos_private.h Thu Nov 17 14:49:03 2016
@@ -203,7 +203,6 @@ svn_repos__config_pool_create(svn_repos_
  * configuration specified by PATH.  If the latter is a URL, we read the
  * data from a local repository.  CONFIG_POOL will store the configuration
  * and make further callers use the same instance if the content matches.
- * If KEY is not NULL, *KEY will be set to a unique ID - if available.
  * Section and option names will be case-insensitive.
  *
  * If MUST_EXIST is TRUE, a missing config file is also an error, *CFG
@@ -220,7 +219,6 @@ svn_repos__config_pool_create(svn_repos_
  */
 svn_error_t *
 svn_repos__config_pool_get(svn_config_t **cfg,
-                           svn_membuf_t **key,
                            svn_repos__config_pool_t *config_pool,
                            const char *path,
                            svn_boolean_t must_exist,

Modified: subversion/branches/authzperf/subversion/libsvn_repos/config_pool.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/config_pool.c?rev=1770201&r1=1770200&r2=1770201&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_repos/config_pool.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_repos/config_pool.c Thu Nov 17 14:49:03 2016
@@ -52,16 +52,15 @@ checksum_as_key(svn_checksum_t *checksum
   return result;
 }
 
-/* Set *CFG to the configuration passed in as text in CONTENTS and *KEY to
- * the corresponding object pool key.  If no such configuration exists in
- * CONFIG_POOL, yet, parse CONTENTS and cache the result.
+/* Set *CFG to the configuration passed in as text in CONTENTS.  If no such
+ * configuration exists in CONFIG_POOL, yet, parse CONTENTS and cache the
+ * result.
  *
  * RESULT_POOL determines the lifetime of the returned reference and
  * SCRATCH_POOL is being used for temporary allocations.
  */
 static svn_error_t *
 auto_parse(svn_config_t **cfg,
-           svn_membuf_t **key,
            svn_repos__config_pool_t *config_pool,
            svn_stringbuf_t *contents,
            apr_pool_t *result_pool,
@@ -70,15 +69,16 @@ auto_parse(svn_config_t **cfg,
   svn_checksum_t *checksum;
   svn_config_t *config;
   apr_pool_t *cfg_pool;
+  svn_membuf_t *key;
 
   /* calculate SHA1 over the whole file contents */
   SVN_ERR(svn_checksum(&checksum, svn_checksum_sha1,
                        contents->data, contents->len, scratch_pool));
 
   /* return reference to suitable config object if that already exists */
-  *key = checksum_as_key(checksum, result_pool);
+  key = checksum_as_key(checksum, result_pool);
   SVN_ERR(svn_object_pool__lookup((void **)cfg, config_pool,
-                                  *key, result_pool));
+                                  key, result_pool));
   if (*cfg)
     return SVN_NO_ERROR;
 
@@ -93,7 +93,7 @@ auto_parse(svn_config_t **cfg,
   svn_config__set_read_only(config, cfg_pool);
 
   /* add config in pool, handle loads races and return the right config */
-  SVN_ERR(svn_object_pool__insert((void **)cfg, config_pool, *key, config,
+  SVN_ERR(svn_object_pool__insert((void **)cfg, config_pool, key, config,
                                   cfg_pool, result_pool));
 
   return SVN_NO_ERROR;
@@ -108,7 +108,6 @@ auto_parse(svn_config_t **cfg,
  */
 static svn_error_t *
 find_repos_config(svn_config_t **cfg,
-                  svn_membuf_t **key,
                   svn_repos__config_pool_t *config_pool,
                   const char *url,
                   svn_repos_t *preferred_repos,
@@ -169,9 +168,9 @@ find_repos_config(svn_config_t **cfg,
                                FALSE, scratch_pool));
   if (checksum)
     {
-      *key = checksum_as_key(checksum, scratch_pool);
+      svn_membuf_t *key = checksum_as_key(checksum, scratch_pool);
       SVN_ERR(svn_object_pool__lookup((void **)cfg, config_pool,
-                                      *key, result_pool));
+                                      key, result_pool));
     }
 
   /* not parsed, yet? */
@@ -190,7 +189,7 @@ find_repos_config(svn_config_t **cfg,
                                         (apr_size_t)length, scratch_pool));
 
       /* handle it like ordinary file contents and cache it */
-      SVN_ERR(auto_parse(cfg, key, config_pool, contents,
+      SVN_ERR(auto_parse(cfg, config_pool, contents,
                          result_pool, scratch_pool));
     }
 
@@ -210,7 +209,6 @@ svn_repos__config_pool_create(svn_repos_
 
 svn_error_t *
 svn_repos__config_pool_get(svn_config_t **cfg,
-                           svn_membuf_t **key,
                            svn_repos__config_pool_t *config_pool,
                            const char *path,
                            svn_boolean_t must_exist,
@@ -220,17 +218,11 @@ svn_repos__config_pool_get(svn_config_t
   svn_error_t *err = SVN_NO_ERROR;
   apr_pool_t *scratch_pool = svn_pool_create(pool);
 
-  /* make sure we always have a *KEY object */
-  svn_membuf_t *local_key = NULL;
-  if (key == NULL)
-    key = &local_key;
-  else
-    *key = NULL;
 
   if (svn_path_is_url(path))
     {
       /* Read and cache the configuration.  This may fail. */
-      err = find_repos_config(cfg, key, config_pool, path,
+      err = find_repos_config(cfg, config_pool, path,
                               preferred_repos, pool, scratch_pool);
       if (err || !*cfg)
         {
@@ -254,7 +246,7 @@ svn_repos__config_pool_get(svn_config_t
       else
         {
           /* parsing and caching will always succeed */
-          err = auto_parse(cfg, key, config_pool, contents,
+          err = auto_parse(cfg, config_pool, contents,
                            pool, scratch_pool);
         }
     }

Modified: subversion/branches/authzperf/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/svnserve/serve.c?rev=1770201&r1=1770200&r2=1770201&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/svnserve/serve.c (original)
+++ subversion/branches/authzperf/subversion/svnserve/serve.c Thu Nov 17 14:49:03 2016
@@ -226,7 +226,7 @@ load_pwdb_config(repository_t *repositor
       pwdb_path = svn_dirent_internal_style(pwdb_path, pool);
       pwdb_path = svn_dirent_join(repository->base, pwdb_path, pool);
 
-      err = svn_repos__config_pool_get(&repository->pwdb, NULL, config_pool,
+      err = svn_repos__config_pool_get(&repository->pwdb, config_pool,
                                        pwdb_path, TRUE,
                                        repository->repos, pool);
       if (err)
@@ -3699,7 +3699,7 @@ find_repos(const char *url,
     {
       repository->base = svn_repos_conf_dir(repository->repos, result_pool);
 
-      SVN_ERR(svn_repos__config_pool_get(&cfg, NULL, config_pool,
+      SVN_ERR(svn_repos__config_pool_get(&cfg, config_pool,
                                          svn_repos_svnserve_conf
                                             (repository->repos, result_pool),
                                          FALSE, repository->repos,

Modified: subversion/branches/authzperf/subversion/svnserve/svnserve.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/svnserve/svnserve.c?rev=1770201&r1=1770200&r2=1770201&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/svnserve/svnserve.c (original)
+++ subversion/branches/authzperf/subversion/svnserve/svnserve.c Thu Nov 17 14:49:03 2016
@@ -1057,7 +1057,7 @@ sub_main(int *exit_code, int argc, const
     {
       params.base = svn_dirent_dirname(config_filename, pool);
 
-      SVN_ERR(svn_repos__config_pool_get(&params.cfg, NULL,
+      SVN_ERR(svn_repos__config_pool_get(&params.cfg,
                                          params.config_pool,
                                          config_filename,
                                          TRUE, /* must_exist */

Modified: subversion/branches/authzperf/subversion/tests/libsvn_repos/repos-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_repos/repos-test.c?rev=1770201&r1=1770200&r2=1770201&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_repos/repos-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_repos/repos-test.c Thu Nov 17 14:49:03 2016
@@ -3928,7 +3928,7 @@ test_config_pool(const svn_test_opts_t *
   for (i = 0; i < 4; ++i)
     {
       SVN_ERR(svn_repos__config_pool_get(
-                                    &cfg, NULL, config_pool,
+                                    &cfg, config_pool,
                                     svn_dirent_join(wrk_dir,
                                                     "config-pool-test1.cfg",
                                                     pool),
@@ -3947,7 +3947,7 @@ test_config_pool(const svn_test_opts_t *
   for (i = 0; i < 4; ++i)
     {
       SVN_ERR(svn_repos__config_pool_get(
-                                    &cfg, NULL, config_pool,
+                                    &cfg, config_pool,
                                     svn_dirent_join(wrk_dir,
                                                     "config-pool-test2.cfg",
                                                     pool),
@@ -3963,7 +3963,7 @@ test_config_pool(const svn_test_opts_t *
   for (i = 0; i < 2; ++i)
     {
       SVN_ERR(svn_repos__config_pool_get(
-                                    &cfg, NULL, config_pool,
+                                    &cfg, config_pool,
                                     svn_dirent_join(wrk_dir,
                                                     "config-pool-test3.cfg",
                                                     pool),
@@ -3993,7 +3993,7 @@ test_config_pool(const svn_test_opts_t *
   SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
 
   /* reading the config from the repo should still give cfg1 */
-  SVN_ERR(svn_repos__config_pool_get(&cfg, NULL, config_pool,
+  SVN_ERR(svn_repos__config_pool_get(&cfg, config_pool,
                                      svn_path_url_add_component2(
                                                     repo_root_url,
                                                     "dir/config", pool),
@@ -4011,7 +4011,7 @@ test_config_pool(const svn_test_opts_t *
   SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
 
   /* reading the config from the repo should give cfg2 now */
-  SVN_ERR(svn_repos__config_pool_get(&cfg, NULL, config_pool,
+  SVN_ERR(svn_repos__config_pool_get(&cfg, config_pool,
                                      svn_path_url_add_component2(
                                                     repo_root_url,
                                                     "dir/config", pool),
@@ -4020,7 +4020,7 @@ test_config_pool(const svn_test_opts_t *
   svn_pool_clear(subpool);
 
   /* reading the copied config should still give cfg1 */
-  SVN_ERR(svn_repos__config_pool_get(&cfg, NULL, config_pool,
+  SVN_ERR(svn_repos__config_pool_get(&cfg, config_pool,
                                      svn_path_url_add_component2(
                                                     repo_root_url,
                                                     "another-dir/config",
@@ -4030,13 +4030,13 @@ test_config_pool(const svn_test_opts_t *
   svn_pool_clear(subpool);
 
   /* once again: repeated reads.  This triggers a different code path. */
-  SVN_ERR(svn_repos__config_pool_get(&cfg, NULL, config_pool,
+  SVN_ERR(svn_repos__config_pool_get(&cfg, config_pool,
                                      svn_path_url_add_component2(
                                                     repo_root_url,
                                                     "dir/config", pool),
                                      TRUE, NULL, subpool));
   SVN_TEST_ASSERT(cfg->sections == sections2);
-  SVN_ERR(svn_repos__config_pool_get(&cfg, NULL, config_pool,
+  SVN_ERR(svn_repos__config_pool_get(&cfg, config_pool,
                                      svn_path_url_add_component2(
                                                     repo_root_url,
                                                     "another-dir/config",
@@ -4046,13 +4046,13 @@ test_config_pool(const svn_test_opts_t *
   svn_pool_clear(subpool);
 
   /* access paths that don't exist */
-  SVN_TEST_ASSERT_ERROR(svn_repos__config_pool_get(&cfg, NULL, config_pool,
+  SVN_TEST_ASSERT_ERROR(svn_repos__config_pool_get(&cfg, config_pool,
                           svn_path_url_add_component2(repo_root_url, "X",
                                                       pool),
                           TRUE, NULL, subpool),
                         SVN_ERR_ILLEGAL_TARGET);
-  err = svn_repos__config_pool_get(&cfg, NULL, config_pool, "X.cfg",
-                                   TRUE, NULL, subpool);
+  err = svn_repos__config_pool_get(&cfg, config_pool, "X.cfg", TRUE, NULL,
+                                   subpool);
   SVN_TEST_ASSERT(err && APR_STATUS_IS_ENOENT(err->apr_err));
   svn_error_clear(err);
   svn_pool_clear(subpool);