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

[Patch] Make svn_tristate_t compatible with svn_boolean_t

From: Stefan Fuhrmann <stefanfuhrmann_at_alice-dsl.de>
Date: Thu, 04 Nov 2010 00:21:07 +0100

Hi there,

after stumbling twice over this issue, I ran grep
and found that the current usage of svn_tristate_t
does not depend on the actual numerical values
used for its states.

Therefore, I propose to define svn_tristate_false
equal to FALSE and svn_tristate_true equal to
TRUE. That way, we can compare booleans with
tristates and assign booleans to tristates. Without
that, we need to write code like

if ((get_some_bool() ? svn_tristate_true : svn_tristate_false) ==
get_a_tristate())
  ...

Also, the following will compile without warning but
requires the patch to do what was intended:

// FALSE becomes "unknown", TRUE becomes "false"
svn_tristate_t my_tristate = get_some_bool();

-- Stefan^2.

[[[
Make svn_tristate_t mainly compatible to svn_boolean_t
by making its numerical values match the ones used for
svn_boolean_t.

* subversion/include/svn_types.h
   (svn_tristate_t): define *_true and *_false in terms of
   the svn_boolean_t values TRUE and FALSE, respectively.
]]]

Received on 2010-11-04 00:22:06 CET

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