On 04.09.2012 21:14, Stefan Küng wrote: > On 04.09.2012 21:07, Branko Čibej wrote: >> On 04.09.2012 20:42, Stefan Küng wrote: >>> Seems I got confused here: >>> What we have to pass to almost each svn API is the config hash for the >>> svn_client_ctx_t struct. That's what I need a copy of. >> >> The svn_config_* functions work with svn_config_t object. The tmp_key >> and tmp_value fields in those object are in fact the ones that prevent >> you from reading the same svn_config_t from multiple threads without >> synchronization. >> >>> And as Bert already noticed: apr_hash_copy only does a shallow copy, >>> not a deep copy. Seems I have to iterate over the hash and copy every >>> item separately. >> >> That is correct. You'll also have to duplicate the svn_config_t >> structure itself, I think that essentially means doing an >> svn_config_create and copying over "x_values" and >> "section_names_case_sensitive"; and, of course, doing the deep copy of >> "sections". >> >> If you do the deep copy properly -- i.e., copying the keys and values >> into the new config_t's pool as well as the hashes -- then you'll save >> yourself a bit of trouble with pool lifetimes, too. >> >>> I'll do that first in TSVN, then do some tests. >>> After that I can use that code to create an svn_config_dup() API if >>> still required. >> >> Why not just write svn_config_dup in libsvn_subr/config.c? Surely >> there's no reason to keep this functionality out of the core libraries. > > This will be a new API which won't get backported. > But in TSVN we have the problem now and need to fix it. > > So I'll have to implement it there as well, at least until 1.8 is out.
Ah, yes, good point. Still, writing the code only once wouldn't be that bad. :) -- Brane -- Certified & Supported Apache Subversion Downloads: http://www.wandisco.com/subversion/download