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

Re: svn commit: r34714 - trunk/subversion/libsvn_wc

From: Branko Cibej <brane_at_xbc.nu>
Date: Tue, 16 Dec 2008 09:26:51 +0100

C. Michael Pilato wrote:
> Hyrum K. Wright wrote:
>
>> Author: hwright
>> Date: Mon Dec 15 07:53:36 2008
>> New Revision: 34714
>>
>> Log:
>> * subversion/libsvn_wc/props.c
>> (svn_wc__has_props): Avoid an if-else by directly assigning a boolean
>> value.
>>
>> Modified:
>> trunk/subversion/libsvn_wc/props.c
>>
>> Modified: trunk/subversion/libsvn_wc/props.c
>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/props.c?pathrev=34714&r1=34713&r2=34714
>> ==============================================================================
>> --- trunk/subversion/libsvn_wc/props.c Mon Dec 15 07:48:41 2008 (r34713)
>> +++ trunk/subversion/libsvn_wc/props.c Mon Dec 15 07:53:36 2008 (r34714)
>> @@ -2772,10 +2772,7 @@ svn_wc__has_props(svn_boolean_t *has_pro
>> svn_wc__props_working, FALSE, pool));
>> SVN_ERR(empty_props_p(&is_empty, prop_path, pool));
>>
>> - if (is_empty)
>> - *has_props = FALSE;
>> - else
>> - *has_props = TRUE;
>> + *has_props = !is_empty;
>>
>> return SVN_NO_ERROR;
>> }
>>
>
> For some reason, I was thinking we tried to avoid doing this. Something
> about the logical operations not necessarily resulting in our specific TRUE
> and FALSE values? I dunno, and I could be completely misremembering.
>

Our specific TRUE and FALSE values are 1 and 0, respectively. The result
of logical operations in C is 1 or 0, by definition.

> You could also use a 1-liner ternary:
>
> *has_props = is_empty ? FALSE : TRUE;
>

Yuck. Might as well rewrite the whole thing in COBOL to make sure the
code is not too terse. :)

-- Brane

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=984851
Received on 2008-12-16 09:27:17 CET

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.