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

Re: svn commit: r27180 - in trunk/subversion: include libsvn_client libsvn_wc svn

From: Eric Gillespie <epg_at_google.com>
Date: 2007-10-16 04:37:24 CEST

"C. Michael Pilato" <cmpilato@collab.net> writes:

> Eric Gillespie wrote:
> >> +svn_wc_conflict_result_t *
> >> +svn_wc_create_conflict_result(svn_wc_conflict_choice_t choice,
> >> + const char *merged_file,
> >> + apr_pool_t *pool)
> >> +{
> >> + svn_wc_conflict_result_t *result =3D apr_pcalloc(pool, sizeof(*resu=
> lt));
> >=20
> > You explicitly initialize the only two fields, so just use palloc
> > instead of pcalloc.
>
> Aaaaah... sorry, while you are absolutely correct in your thinking, I don't
> really care for that piece of advice, because you just *know* the next time
> somebody adds a field to that structure whose default value is supposed to
> be 0, they'll not notice that the memory wasn't cleared. I mean, really,
> what does a memset() cost today, and what effect will that have on the cost
> of an 'svn update' operation anyway?

It's not about the cost: explicit is better than implicit.
calloc only initializes to 0; who says that's the right default
for any given field? But, it's an age-old argument, and svn is
full of pcalloc already, so I'm not going to fight hard ;->.
It's like watching the trailing whitespace creep back in...

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 16 04:37:44 2007

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.