rhuij...@apache.org wrote on Sun, May 08, 2011 at 13:20:08 -0000: > Author: rhuijben > Date: Sun May 8 13:20:08 2011 > New Revision: 1100733 > > URL: http://svn.apache.org/viewvc?rev=1100733&view=rev > Log: > Make a property hash helper function from the update editor public to allow > using it in other editors. > > * subversion/include/svn_props.h > (svn_prop_array_to_hash): New function. > > * subversion/libsvn_subr/properties.c > (svn_prop_array_to_hash): New function. > > * subversion/libsvn_wc/update_editor.c > (prop_hash_from_array): Remove function (which is now known as > svn_prop_array_to_hash). > (close_directory, close_file, svn_wc_add_repos_file4): Update callers. > > Modified: > subversion/trunk/subversion/include/svn_props.h > subversion/trunk/subversion/libsvn_subr/properties.c > subversion/trunk/subversion/libsvn_wc/update_editor.c > > Modified: subversion/trunk/subversion/include/svn_props.h > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_props.h?rev=1100733&r1=1100732&r2=1100733&view=diff > ============================================================================== > --- subversion/trunk/subversion/include/svn_props.h (original) > +++ subversion/trunk/subversion/include/svn_props.h Sun May 8 13:20:08 2011 > @@ -97,6 +97,16 @@ svn_prop_hash_to_array(apr_hash_t *hash, > apr_pool_t *pool); > > /** > + * Given an array of svn_prop_t items, return a hash mapping const char * > + * property names to const svn_string_t * values. > + * > + * @since New in 1.7. > + */ > +apr_hash_t * > +svn_prop_array_to_hash(const apr_array_header_t *properties, > + apr_pool_t *result); > +
How does it handle an svn_prop_t with a NULL 'value' member? > +/** > * Creates a deep copy of @a hash (keys <tt>const char *</tt> and > * values <tt>const svn_string_t</tt>) in @a pool. > * > > Modified: subversion/trunk/subversion/libsvn_subr/properties.c > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/properties.c?rev=1100733&r1=1100732&r2=1100733&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_subr/properties.c (original) > +++ subversion/trunk/subversion/libsvn_subr/properties.c Sun May 8 13:20:08 > 2011 > @@ -221,6 +221,21 @@ svn_prop_diffs(apr_array_header_t **prop > return SVN_NO_ERROR; > } > > +apr_hash_t * > +svn_prop_array_to_hash(const apr_array_header_t *properties, > + apr_pool_t *pool) > +{ > + int i; > + apr_hash_t *prop_hash = apr_hash_make(pool); > + > + for (i = 0; i < properties->nelts; i++) > + { > + const svn_prop_t *prop = &APR_ARRAY_IDX(properties, i, svn_prop_t); > + apr_hash_set(prop_hash, prop->name, APR_HASH_KEY_STRING, prop->value); > + } > + > + return prop_hash; > +}