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

Re: [PATCH][MERGE-TRACKING] Step 2 of repos to repos copyfrom info recording

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-09-27 13:37:12 CEST

Madan U Sreenivasan wrote:
> On Wed, 27 Sep 2006 16:40:59 +0530, Kamesh Jayachandran
> <kamesh@collab.net> wrote:
>
>>
>>> +/* Log callback for obtaining the copyfrom revision of + a given
>>> path. */
>>> +static svn_error_t *
>>> +copyfrom_receiver(void *baton,
>>> + apr_hash_t *changed_paths,
>>> + svn_revnum_t revision,
>>> + const char *author,
>>> + const char *date,
>>> + const char *message,
>>> + apr_pool_t *pool)
>>> +{
>>> + svn_revnum_t *svn_revnum = baton;
>>> + *svn_revnum = revision;
>>>
>> I could see duplicate assignment here ???
>
> No, the first statement assigns the address and the second one assigns
> a value.
My eyes have decieved me. Fine.
>
>
>>> + return SVN_NO_ERROR;
>>> +}
>>> +
>>> +/* Obtain the copyfrom mergeinfo and the existing mergeinfo of
>>> + the source path, merge them and set as a svn_string_t in
>>> + TARGET_MERGEINFO. */
>>> +static svn_error_t *
>>> +calculate_target_mergeinfo(svn_ra_session_t *ra_session,
>>> + svn_string_t **target_mergeinfo,
>>> + const char *src_url,
>>> + const char *src_rel,
>>> + svn_revnum_t src_revnum,
>>> + apr_pool_t *pool)
>>> +{
>>> + const char *repos_root;
>>> + const char *copyfrom_path = src_url;
>>> + apr_hash_t *copyfrom_mergeinfo;
>>> +
>>> + /* Find src path relative to the repos root */
>>> + SVN_ERR(svn_ra_get_repos_root(ra_session, &repos_root, pool));
>>> + while (*copyfrom_path++ == *repos_root++ );
>>> + copyfrom_path--;
>>>
>> I prefer preincrement as it does not need a temp copy of variable,
>> may be the compiler could be intelligent in making them preincrements
>> in void contexts like this.
>> Why not
>>
>> while (*(--copyfrom_path) == *(--repos_root) );
>
> you mean pre-*increment*, right?
Yes.
>
> pre-increment will go against the logic in this case (we have to check
> equality character by character). Preincrement will avoid check the
> first character.
>
>> --copyfrom_path;
>
> I could use predecrement for the second line, but IMHO, thats really
> not of much significance. If you really feel strong about this, lets
> change this.
>
May be compiler itself might do the optimization here. not to bother too
much.

With regards
Kamesh Jayachandran

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Sep 27 13:36:51 2006

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.