[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: Philip Martin <philip.martin_at_wandisco.com>
Date: Fri, 20 May 2011 11:38:34 +0100

Stefan Fuhrmann <eqfox_at_web.de> writes:

> On 15.05.2011 20:23, Blair Zajac wrote:
>> On May 15, 2011, at 11:06 AM, stefan2_at_apache.org wrote:
>>> 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.

It's still not clear, gcc warns:

../src/subversion/libsvn_ra_svn/marshal.c: In function ‘read_string’:
../src/subversion/libsvn_ra_svn/marshal.c:645: warning: assignment discards qualifiers from pointer target type

Your patch says that you are returning a pointer to const because the
string must not reallocate, but here you are casting away const. Why is
that safe?

-- 
Philip
Received on 2011-05-20 12:39:15 CEST

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