[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1311469 - in /subversion/trunk/subversion: include/svn_config.h libsvn_subr/config.c

From: Hyrum K Wright <hyrum.wright_at_wandisco.com>
Date: Mon, 9 Apr 2012 16:50:58 -0500

On Mon, Apr 9, 2012 at 4:34 PM, <stefan2_at_apache.org> wrote:
> Author: stefan2
> Date: Mon Apr  9 21:34:21 2012
> New Revision: 1311469
>
> URL: http://svn.apache.org/viewvc?rev=1311469&view=rev
> Log:
> Add special API for reading and writing integer settings
> (similar to what we already have for bools).
>
> * subversion/include/svn_config.h
>  (svn_config_get_int64, svn_config_set_int64): declare new convenience API
> * subversion/libsvn_subr/config.c
>  (svn_config_get_int64, svn_config_set_int64): implement new API
>
> Modified:
>    subversion/trunk/subversion/include/svn_config.h
>    subversion/trunk/subversion/libsvn_subr/config.c
>
> Modified: subversion/trunk/subversion/include/svn_config.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_config.h?rev=1311469&r1=1311468&r2=1311469&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_config.h (original)
> +++ subversion/trunk/subversion/include/svn_config.h Mon Apr  9 21:34:21 2012
> @@ -303,6 +303,32 @@ svn_config_set_bool(svn_config_t *cfg,
>                     const char *option,
>                     svn_boolean_t value);
>
> +/** Like svn_config_get(), but for 64 bit signed integers.
> + *
> + * Parses the option as an integer value. Returns an error if the option
> + * could not be converted to an integer.
> + *
> + * @since New in 1.8
> + */
> +svn_error_t *
> +svn_config_get_int64(svn_config_t *cfg,
> +                     apr_int64_t *valuep,
> +                     const char *section,
> +                     const char *option,
> +                     apr_int64_t default_value);
> +
> +/** Like svn_config_set(), but for 64 bit signed integers.
> + *
> + * Sets the option to the signed decimal @a value.
> + *
> + * @since New in 1.8
> + */
> +void
> +svn_config_set_int64(svn_config_t *cfg,
> +                     const char *section,
> +                     const char *option,
> +                     apr_int64_t value);
> +
>  /** Like svn_config_get(), but only for yes/no/ask values.
>  *
>  * Parse @a option in @a section and set @a *valuep to one of
>
> Modified: subversion/trunk/subversion/libsvn_subr/config.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/config.c?rev=1311469&r1=1311468&r2=1311469&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_subr/config.c (original)
> +++ subversion/trunk/subversion/libsvn_subr/config.c Mon Apr  9 21:34:21 2012
> @@ -697,6 +697,33 @@ svn_config_set_bool(svn_config_t *cfg,
>  }
>
>  svn_error_t *
> +svn_config_get_int64(svn_config_t *cfg,
> +                     apr_int64_t *valuep,
> +                     const char *section,
> +                     const char *option,
> +                     apr_int64_t default_value)
> +{
> +  const char *tmp_value;
> +  svn_config_get(cfg, &tmp_value, section, option, NULL);
> +  if (tmp_value)
> +    return svn_cstring_strtoui64(valuep, tmp_value,
> +                                 APR_INT64_MIN, APR_INT64_MAX, 10);

I think you need to include "private/svn_dep_compat.h" to ensure these
values are defined.

-Hyrum

> +
> +  *valuep = default_value;
> +  return SVN_NO_ERROR;
> +}
> +
> +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));
> +}
> +
> +svn_error_t *
>  svn_config_get_yes_no_ask(svn_config_t *cfg, const char **valuep,
>                           const char *section, const char *option,
>                           const char* default_value)
>
>

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Received on 2012-04-09 23:51:32 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.