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

Re: svn commit: r36203 - trunk/subversion/libsvn_ra_serf

From: Ivan Zhakov <ivan_at_visualsvn.com>
Date: Sat, 28 Feb 2009 02:06:53 +0300

On Sat, Feb 28, 2009 at 1:57 AM, Bert Huijben <rhuijben_at_sharpsvn.net> wrote:
> Modified: trunk/subversion/libsvn_ra_serf/commit.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_ra_serf/commit.c?pathrev=36203&r1=36202&r2=36203
> ==============================================================================
> --- trunk/subversion/libsvn_ra_serf/commit.c    Fri Feb 27 13:50:27 2009        (r36202)
> +++ trunk/subversion/libsvn_ra_serf/commit.c    Fri Feb 27 14:57:15 2009        (r36203)
> @@ -282,6 +282,9 @@ handle_checkout(serf_request_t *request,
>       apr_uri_parse(pool, location, &uri);
>
>       ctx->resource_url = svn_uri_canonicalize(uri.path, ctx->pool);
> +
> +      if (ctx->resource_url == uri.path)
> +        ctx->resource_url = apr_pstrdup(ctx->pool, ctx->resource_url);
Hi Bert,

Sorry but I don't like this fix. It looks like premature optimization
which is always bad thing.

We should follow contract of svn_uri_canonicalize function that could
theoretically return pointer to other than first character in provided
buffer.

So it's much better just add apr_pstrdup() in all cases from point of
readability and preventing memory errors.

-- 
Ivan Zhakov
VisualSVN Team
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1241338
Received on 2009-02-28 00:07:09 CET

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