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

Re: [PATCH] dup function for svn_info_t

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-10-11 02:20:49 CEST

> "Peter N. Lundblad" <peter@famlundblad.se> writes:
>>On Mon, 13 Jun 2005, Chris Foote wrote:
>>>Branko ─îibej wrote:
>>>>>+svn_info_t *
>>>>>+svn_info_dup (const svn_info_t *info, apr_pool_t *pool)
>>>>>+ svn_info_t *dupinfo = apr_pcalloc (pool, sizeof(*dupinfo));
>>>>>+ /* Perform a trivial copy ... */
>>>>>+ *dupinfo = *info;
>>>>Since you're copying the struct anyway, there's no sense in using
>>>True, although this is what svn_wc_entry_dup uses.
>>I don't mind changing that too, even if this is really cycle-counting if

It's not cycle counting, because I don't care whether apr_palloc is faster than
apr_pcalloc. The reason to use apr_palloc is code clarity. It avoids the
reader wasting time checking: "This code seems to initialize the memory twice;
am I misunderstanding part of it? apr_pcalloc... checking... yes, that really
does initialise it. The copy "*dupinfo = *info"... checking... yes, that
really is copying the whole size of the structure, so that does too. Oh well."

svn_wc_entry_dup() fixed in r16647. Thanks for pointing it out.

- Julian

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 11 02:21:38 2005

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.