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

Re: API change - rename svn_hash_get_cstring/bool() to svn_config_hash_get_*()

From: Stefan Fuhrmann <eqfox_at_web.de>
Date: Wed, 15 Jun 2011 21:29:26 +0200

On 15.06.2011 15:29, Julian Foad wrote:
> A heads-up: I'm renaming svn_hash_get_bool() to
> svn_config_hash_get_bool(), and svn_hash_get_cstring() to
> svn_config_hash_get(), moving them from svn_hash.h to svn_config.h.
> They are being used only for config hashes, and don't seem like
> general-purpose hash functions. In particular, _get_bool() looks for a
> variety of human-oriented boolean-like strings (on, off, yes, no, etc.).
>
> Note that we already have svn_config_get_bool() and svn_config_get(),
> which are similar but operate on a structured config file object,
> whereas the functions I'm renaming operate on a simple hash.
The reason why I explicitly didn't follow that direct in the first place
is that svn_hash is very different from svn_config. Moving the
get_bool function to svn_config would basically make it an orphan:
There is no other hash-related function in there let alone a set of
functions that take hashes as kind of an alternative to svn_config
structures.

So, I'm -0 on the rename and -0 on the move.

-- Stefan^2.
>
> Current APIs:
> [[[
> # In svn_hash.h:
>
> /** Find the value of a @a key in @a hash, return the value.
> *
> * If @a hash is @c NULL or if the @a key cannot be found, the
> * @a default_value will be returned.
> *
> * @since New in 1.7.
> */
> const char *
> svn_hash_get_cstring(apr_hash_t *hash,
> const char *key,
> const char *default_value);
>
> /** Like svn_hash_get_cstring(), but for boolean values.
> *
> * Parses the value as a boolean value. The recognized representations
> * are 'TRUE'/'FALSE', 'yes'/'no', 'on'/'off', '1'/'0'; case does not
> * matter.
> *
> * @since New in 1.7.
> */
> svn_boolean_t
> svn_hash_get_bool(apr_hash_t *hash,
> const char *key,
> svn_boolean_t default_value);
>
> # In svn_config.h:
>
> /** Find the value of a (@a section, @a option) pair in @a cfg, set @a
> * *valuep to the value.
> *
> * If @a cfg is @c NULL, just sets @a *valuep to @a default_value. If
> * the value does not exist, expand and return @a default_value. @a
> * default_value can be NULL.
> *
> * The returned value will be valid at least until the next call to
> * svn_config_get(), or for the lifetime of @a default_value. It is
> * safest to consume the returned value immediately.
> *
> * This function may change @a cfg by expanding option values.
> */
> void
> svn_config_get(svn_config_t *cfg,
> const char **valuep,
> const char *section,
> const char *option,
> const char *default_value);
>
> /** Like svn_config_get(), but for boolean values.
> *
> * Parses the option as a boolean value. The recognized representations
> * are 'TRUE'/'FALSE', 'yes'/'no', 'on'/'off', '1'/'0'; case does not
> * matter. Returns an error if the option doesn't contain a known string.
> */
> svn_error_t *
> svn_config_get_bool(svn_config_t *cfg,
> svn_boolean_t *valuep,
> const char *section,
> const char *option,
> svn_boolean_t default_value);
> ]]]
>
> Let me know if you have any concerns. As I don't anticipate any, I'll
> probably make the change before waiting for replies.
>
> - Julian
>
>
>
Received on 2011-06-15 21:29:52 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.