[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] code simplification of get_merge_info_for_path

From: Malcolm Rowe <malcolm-svn-dev_at_farside.org.uk>
Date: 2006-10-09 11:05:54 CEST

On Mon, Oct 09, 2006 at 12:00:49PM +0530, Kamesh Jayachandran wrote:
> Use strcpy rather than mimicing the behaviour of 'strcpy'.
>

> @@ -490,8 +488,7 @@
> path string. */
> toappend = apr_pcalloc(pool,
> (strlen(path) - parentpath->len) + 1);
> - for (i = 0, p = &path[parentpath->len + 1]; *p; i++, p++)
> - *(toappend + i) = *p;
> + strcpy(toappend, path+(parentpath->len + 1));
> append_component_to_paths(&translatedhash, cacheresult,
> toappend, pool);
>

Nice find, although I find the &path[n] syntax easier to parse myself
when n is complex.

However, I don't understand why this function needs to copy part of path
into pool - do we need to modify toappend later?

i.e. what's wrong with just this?

  toappend = &path[parentpath->len + 1];

Alternatively, if you do need to copy it, just call apr_pstrdup() rather
than pcalloc/strcpy.

Regards,
Malcolm

  • application/pgp-signature attachment: stored
Received on Mon Oct 9 11:06:11 2006

This is an archived mail posted to the Subversion Dev mailing list.