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 2012/04/09 23:34:21 UTC
svn commit: r1311469 - in /subversion/trunk/subversion: include/svn_config.h
libsvn_subr/config.c
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);
+
+ *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)
Re: svn commit: r1311469 - in /subversion/trunk/subversion:
include/svn_config.h libsvn_subr/config.c
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Mon, Apr 9, 2012 at 4:34 PM, <st...@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/
Re: svn commit: r1311469 - in /subversion/trunk/subversion: include/svn_config.h
libsvn_subr/config.c
Posted by Stefan Fuhrmann <eq...@web.de>.
Philip Martin wrote:
> stefan2@apache.org writes:
>
>> 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);
> svn_cstring_strtoi64?
>
> svn_config_get_uint46?
>
> ../src/subversion/libsvn_subr/config.c: In function ‘svn_config_get_int64’:
> ../src/subversion/libsvn_subr/config.c:711: warning: pointer targets in passing argument 1 of ‘svn_cstring_strtoui64’ differ in signedness
> ../src/subversion/include/svn_string.h:482: note: expected ‘apr_uint64_t *’ but argument is of type ‘apr_int64_t *’
>
A simple auto-completion artifact.
Fixed in r1311794.
Thanks for the review!
-- Stefan^2.
Re: svn commit: r1311469 - in /subversion/trunk/subversion: include/svn_config.h libsvn_subr/config.c
Posted by Philip Martin <ph...@wandisco.com>.
stefan2@apache.org writes:
> 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).
> 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);
svn_cstring_strtoi64?
svn_config_get_uint46?
../src/subversion/libsvn_subr/config.c: In function ‘svn_config_get_int64’:
../src/subversion/libsvn_subr/config.c:711: warning: pointer targets in passing argument 1 of ‘svn_cstring_strtoui64’ differ in signedness
../src/subversion/include/svn_string.h:482: note: expected ‘apr_uint64_t *’ but argument is of type ‘apr_int64_t *’
> +
> + *valuep = default_value;
> + return SVN_NO_ERROR;
> +}
--
Philip
Re: svn commit: r1311469 - in /subversion/trunk/subversion:
include/svn_config.h libsvn_subr/config.c
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Mon, Apr 9, 2012 at 4:34 PM, <st...@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/