[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: Stefan Fuhrmann <eqfox_at_web.de>
Date: Thu, 19 May 2011 17:43:34 +0200

On 15.05.2011 20:23, Blair Zajac wrote:
> 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.
r1124677 still does essentially the same but moves
it into a separate function and explains in detail how
it works and why it is safe.

-- Stefan^2.
Received on 2011-05-19 17:44:04 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.