Beispiel #1
0
svn_error_t *
svn_config_copy_config(apr_hash_t **cfg_hash,
                       apr_hash_t *src_hash,
                       apr_pool_t *pool)
{
  apr_hash_index_t *cidx;

  *cfg_hash = apr_hash_make(pool);
  for (cidx = apr_hash_first(pool, src_hash);
       cidx != NULL;
       cidx = apr_hash_next(cidx))
  {
    const void *ckey;
    void *cval;
    apr_ssize_t ckeyLength;
    svn_config_t * srcconfig;
    svn_config_t * destconfig;

    apr_hash_this(cidx, &ckey, &ckeyLength, &cval);
    srcconfig = cval;

    SVN_ERR(svn_config_dup(&destconfig, srcconfig, pool));

    apr_hash_set(*cfg_hash,
                 apr_pstrdup(pool, (const char*)ckey),
                 ckeyLength, destconfig);
  }

  return SVN_NO_ERROR;
}
Beispiel #2
0
static svn_error_t *
test_read_only_mode(const svn_test_opts_t *opts,
                    apr_pool_t *pool)
{
  svn_config_t *cfg;
  svn_config_t *cfg2;
  const char *cfg_file;

  SVN_ERR(get_config_file_path(&cfg_file, opts, pool));
  SVN_ERR(svn_config_read3(&cfg, cfg_file, TRUE, TRUE, FALSE, pool));

  /* setting CFG to r/o mode shall toggle the r/o mode and expand values */

  SVN_TEST_ASSERT(!svn_config__is_read_only(cfg));
  SVN_TEST_ASSERT(!svn_config__is_expanded(cfg, "section1", "i"));

  svn_config__set_read_only(cfg, pool);

  SVN_TEST_ASSERT(svn_config__is_read_only(cfg));
  SVN_TEST_ASSERT(svn_config__is_expanded(cfg, "section1", "i"));

  /* copies should be r/w with values */

  SVN_ERR(svn_config_dup(&cfg2, cfg, pool));
  SVN_TEST_ASSERT(!svn_config__is_read_only(cfg2));

  return SVN_NO_ERROR;
}