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

Re: svn commit: r1103490 - /subversion/trunk/subversion/libsvn_ra_svn/marshal.c

From: Blair Zajac <blair_at_orcaware.com>
Date: Sun, 15 May 2011 11:23:49 -0700

On May 15, 2011, at 11:06 AM, stefan2_at_apache.org wrote:

> Author: stefan2
> Date: Sun May 15 18:06:23 2011
> New Revision: 1103490
>
> URL: http://svn.apache.org/viewvc?rev=1103490&view=rev
> Log:
> Eliminate an svn_string_t header allocation and assignment in ra_svn
> protocol handling code.
>
> * subversion/libsvn_ra_svn/marshal.c
> (read_string): "hero-cast" existing stringbuf into svn_string_t
>
> Modified:
> subversion/trunk/subversion/libsvn_ra_svn/marshal.c
>
> Modified: subversion/trunk/subversion/libsvn_ra_svn/marshal.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/marshal.c?rev=1103490&r1=1103489&r2=1103490&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_ra_svn/marshal.c (original)
> +++ subversion/trunk/subversion/libsvn_ra_svn/marshal.c Sun May 15 18:06:23 2011
> @@ -638,11 +638,11 @@ static svn_error_t *read_string(svn_ra_s
> }
>
> /* Return the string properly wrapped into an RA_SVN item.
> + * Note that the svn_string_t structure is identical to the
> + * data and len members in stringbuf.
> */
> item->kind = SVN_RA_SVN_STRING;
> - item->u.string = apr_palloc(pool, sizeof(*item->u.string));
> - item->u.string->data = stringbuf->data;
> - item->u.string->len = stringbuf->len;
> + item->u.string = (svn_string_t *)(&stringbuf->data);

Is this cast really necessary? I would rather take a small cost hit in preference to the code being safe.

Blair
Received on 2011-05-15 20:24:21 CEST

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.