void svn_config_set_bool(svn_config_t *cfg, const char *section, const char *option, svn_boolean_t value) { svn_config_set(cfg, section, option, (value ? SVN_CONFIG_TRUE : SVN_CONFIG_FALSE)); }
void svn_config_set_int64(svn_config_t *cfg, const char *section, const char *option, apr_int64_t value) { svn_config_set(cfg, section, option, apr_psprintf(cfg->pool, "%" APR_INT64_T_FMT, value)); }
/* Callback to copy (name, value) group into the "groups" section of another configuration. */ static svn_boolean_t authz_copy_group(const char *name, const char *value, void *baton, apr_pool_t *pool) { svn_config_t *authz_cfg = baton; svn_config_set(authz_cfg, SVN_CONFIG_SECTION_GROUPS, name, value); return TRUE; }
static svn_error_t * parse_section(svn_config_t *cfg, HKEY hkey, const char *section, svn_stringbuf_t *option, svn_stringbuf_t *value) { DWORD option_len, type, index; LONG err; /* Start with a reasonable size for the buffers. */ svn_stringbuf_ensure(option, SVN_REG_DEFAULT_NAME_SIZE); svn_stringbuf_ensure(value, SVN_REG_DEFAULT_VALUE_SIZE); for (index = 0; ; ++index) { option_len = option->blocksize; err = RegEnumValue(hkey, index, option->data, &option_len, NULL, &type, NULL, NULL); if (err == ERROR_NO_MORE_ITEMS) break; if (err == ERROR_INSUFFICIENT_BUFFER) { svn_stringbuf_ensure(option, option_len); err = RegEnumValue(hkey, index, option->data, &option_len, NULL, &type, NULL, NULL); } if (err != ERROR_SUCCESS) return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, "Can't enumerate registry values"); /* Ignore option names that start with '#', see http://subversion.tigris.org/issues/show_bug.cgi?id=671 */ if (type == REG_SZ && option->data[0] != '#') { DWORD value_len = value->blocksize; err = RegQueryValueEx(hkey, option->data, NULL, NULL, value->data, &value_len); if (err == ERROR_MORE_DATA) { svn_stringbuf_ensure(value, value_len); err = RegQueryValueEx(hkey, option->data, NULL, NULL, value->data, &value_len); } if (err != ERROR_SUCCESS) return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, "Can't read registry value data"); svn_config_set(cfg, section, option->data, value->data); } } return SVN_NO_ERROR; }
static svn_error_t * construct_config(apr_hash_t **config_p, const char *http_library, apr_pool_t *pool) { apr_hash_t *config; svn_config_t *servers; /* Populate SERVERS. */ SVN_ERR(svn_config_create(&servers, FALSE, pool)); svn_config_set(servers, SVN_CONFIG_SECTION_GLOBAL, SVN_CONFIG_OPTION_HTTP_LIBRARY, http_library); /* Populate CONFIG. */ config = apr_hash_make(pool); apr_hash_set(config, SVN_CONFIG_CATEGORY_SERVERS, APR_HASH_KEY_STRING, servers); *config_p = config; return SVN_NO_ERROR; }
static svn_boolean_t merge_callback(void *baton, cfg_section_t *section, cfg_option_t *option) { svn_config_set(baton, section->name, option->name, option->value); return FALSE; }