[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: C. Michael Pilato <cmpilato_at_collab.net>
Date: Mon, 15 Dec 2008 10:58:23 -0500

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.

You could also use a 1-liner ternary:

   *has_props = is_empty ? FALSE : TRUE;

-- 
C. Michael Pilato <cmpilato_at_collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=984527

Received on 2008-12-15 16:58:53 CET

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