Author: ivan
Date: Thu Apr 4 11:54:58 2013
New Revision: 1464478
URL: http://svn.apache.org/r1464478
Log:
Optimize enumerating through svn_config_t options values.
* subversion/libsvn_subr/config.c
(make_string_from_option): Attempt to expand option value only if '%'
character is present.
Modified:
subversion/trunk/subversion/libsvn_subr/config.c
Modified: subversion/trunk/subversion/libsvn_subr/config.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/config.c?rev=1464478&r1=1464477&r2=1464478&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/config.c (original)
+++ subversion/trunk/subversion/libsvn_subr/config.c Thu Apr 4 11:54:58 2013
@@ -464,19 +464,29 @@ make_string_from_option(const char **val
/* Expand the option value if necessary. */
if (!opt->expanded)
{
- apr_pool_t *tmp_pool = (x_pool ? x_pool : svn_pool_create(cfg->x_pool));
+ /* before attempting to expand an option, check for the placeholder.
+ * If none is there, there is no point in calling expand_option_value.
+ */
+ if (strchr(opt->value, '%'))
+ {
+ apr_pool_t *tmp_pool = (x_pool ? x_pool :
svn_pool_create(cfg->x_pool));
- expand_option_value(cfg, section, opt->value, &opt->x_value, tmp_pool);
- opt->expanded = TRUE;
+ expand_option_value(cfg, section, opt->value, &opt->x_value,
tmp_pool);
+ opt->expanded = TRUE;
- if (!x_pool)
+ if (!x_pool)
+ {
+ /* Grab the fully expanded value from tmp_pool before its
+ disappearing act. */
+ if (opt->x_value)
+ opt->x_value = apr_pstrmemdup(cfg->x_pool, opt->x_value,
+ strlen(opt->x_value));
+ svn_pool_destroy(tmp_pool);
+ }
+ }
+ else
{
- /* Grab the fully expanded value from tmp_pool before its
- disappearing act. */
- if (opt->x_value)
- opt->x_value = apr_pstrmemdup(cfg->x_pool, opt->x_value,
- strlen(opt->x_value));
- svn_pool_destroy(tmp_pool);
+ opt->expanded = TRUE;
}
}