You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2012/12/18 20:50:41 UTC
svn commit: r1423603 - in /subversion/trunk/subversion: include/svn_props.h
libsvn_subr/properties.c
Author: julianfoad
Date: Tue Dec 18 19:50:41 2012
New Revision: 1423603
URL: http://svn.apache.org/viewvc?rev=1423603&view=rev
Log:
* subversion/include/svn_props.h,
subversion/libsvn_subr/properties.c
(svn_prop_hash_to_array, svn_prop_hash_dup, svn_prop_get_value,
svn_prop_diffs): Constify the hash inputs, for the convenience of
callers, casting away the 'const' internally where necessary to
satisfy the APR hash APIs.
Modified:
subversion/trunk/subversion/include/svn_props.h
subversion/trunk/subversion/libsvn_subr/properties.c
Modified: subversion/trunk/subversion/include/svn_props.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_props.h?rev=1423603&r1=1423602&r2=1423603&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_props.h (original)
+++ subversion/trunk/subversion/include/svn_props.h Tue Dec 18 19:50:41 2012
@@ -110,7 +110,7 @@ typedef struct svn_prop_inherited_item_t
* @since New in 1.5.
*/
apr_array_header_t *
-svn_prop_hash_to_array(apr_hash_t *hash,
+svn_prop_hash_to_array(const apr_hash_t *hash,
apr_pool_t *pool);
/**
@@ -133,7 +133,7 @@ svn_prop_array_to_hash(const apr_array_h
* @since New in 1.6.
*/
apr_hash_t *
-svn_prop_hash_dup(apr_hash_t *hash,
+svn_prop_hash_dup(const apr_hash_t *hash,
apr_pool_t *pool);
/**
@@ -144,7 +144,7 @@ svn_prop_hash_dup(apr_hash_t *hash,
* @since New in 1.7.
*/
const char *
-svn_prop_get_value(apr_hash_t *properties,
+svn_prop_get_value(const apr_hash_t *properties,
const char *prop_name);
/**
@@ -317,8 +317,8 @@ svn_categorize_props(const apr_array_hea
*/
svn_error_t *
svn_prop_diffs(apr_array_header_t **propdiffs,
- apr_hash_t *target_props,
- apr_hash_t *source_props,
+ const apr_hash_t *target_props,
+ const apr_hash_t *source_props,
apr_pool_t *pool);
Modified: subversion/trunk/subversion/libsvn_subr/properties.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/properties.c?rev=1423603&r1=1423602&r2=1423603&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/properties.c (original)
+++ subversion/trunk/subversion/libsvn_subr/properties.c Tue Dec 18 19:50:41 2012
@@ -244,8 +244,8 @@ svn_categorize_props(const apr_array_hea
svn_error_t *
svn_prop_diffs(apr_array_header_t **propdiffs,
- apr_hash_t *target_props,
- apr_hash_t *source_props,
+ const apr_hash_t *target_props,
+ const apr_hash_t *source_props,
apr_pool_t *pool)
{
apr_hash_index_t *hi;
@@ -257,7 +257,8 @@ svn_prop_diffs(apr_array_header_t **prop
/* Loop over SOURCE_PROPS and examine each key. This will allow us to
detect any `deletion' events or `set-modification' events. */
- for (hi = apr_hash_first(pool, source_props); hi; hi = apr_hash_next(hi))
+ for (hi = apr_hash_first(pool, (apr_hash_t *)source_props); hi;
+ hi = apr_hash_next(hi))
{
const void *key;
apr_ssize_t klen;
@@ -269,7 +270,7 @@ svn_prop_diffs(apr_array_header_t **prop
propval1 = val;
/* Does property name exist in TARGET_PROPS? */
- propval2 = apr_hash_get(target_props, key, klen);
+ propval2 = apr_hash_get((apr_hash_t *)target_props, key, klen);
if (propval2 == NULL)
{
@@ -289,7 +290,8 @@ svn_prop_diffs(apr_array_header_t **prop
/* Loop over TARGET_PROPS and examine each key. This allows us to
detect `set-creation' events */
- for (hi = apr_hash_first(pool, target_props); hi; hi = apr_hash_next(hi))
+ for (hi = apr_hash_first(pool, (apr_hash_t *)target_props); hi;
+ hi = apr_hash_next(hi))
{
const void *key;
apr_ssize_t klen;
@@ -301,7 +303,7 @@ svn_prop_diffs(apr_array_header_t **prop
propval = val;
/* Does property name exist in SOURCE_PROPS? */
- if (NULL == apr_hash_get(source_props, key, klen))
+ if (NULL == apr_hash_get((apr_hash_t *)source_props, key, klen))
{
/* Add a set (creation) event to the array */
svn_prop_t *p = apr_array_push(ary);
@@ -354,13 +356,16 @@ svn_prop_array_dup(const apr_array_heade
}
apr_array_header_t *
-svn_prop_hash_to_array(apr_hash_t *hash, apr_pool_t *pool)
+svn_prop_hash_to_array(const apr_hash_t *hash,
+ apr_pool_t *pool)
{
apr_hash_index_t *hi;
- apr_array_header_t *array = apr_array_make(pool, apr_hash_count(hash),
+ apr_array_header_t *array = apr_array_make(pool,
+ apr_hash_count((apr_hash_t *)hash),
sizeof(svn_prop_t));
- for (hi = apr_hash_first(pool, hash); hi; hi = apr_hash_next(hi))
+ for (hi = apr_hash_first(pool, (apr_hash_t *)hash); hi;
+ hi = apr_hash_next(hi))
{
const void *key;
void *val;
@@ -376,13 +381,14 @@ svn_prop_hash_to_array(apr_hash_t *hash,
}
apr_hash_t *
-svn_prop_hash_dup(apr_hash_t *hash,
+svn_prop_hash_dup(const apr_hash_t *hash,
apr_pool_t *pool)
{
apr_hash_index_t *hi;
apr_hash_t *new_hash = apr_hash_make(pool);
- for (hi = apr_hash_first(pool, hash); hi; hi = apr_hash_next(hi))
+ for (hi = apr_hash_first(pool, (apr_hash_t *)hash); hi;
+ hi = apr_hash_next(hi))
{
const void *key;
apr_ssize_t klen;
@@ -465,7 +471,7 @@ svn_prop_name_is_valid(const char *prop_
}
const char *
-svn_prop_get_value(apr_hash_t *props,
+svn_prop_get_value(const apr_hash_t *props,
const char *prop_name)
{
svn_string_t *str;
@@ -473,7 +479,7 @@ svn_prop_get_value(apr_hash_t *props,
if (!props)
return NULL;
- str = apr_hash_get(props, prop_name, APR_HASH_KEY_STRING);
+ str = apr_hash_get((apr_hash_t *)props, prop_name, APR_HASH_KEY_STRING);
if (str)
return str->data;