Skip to content

Commit 41e13db

Browse files
committed
Add TriState::empty()
1 parent 0e13f2f commit 41e13db

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

src/common/classes/TriState.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ namespace Firebird {
3434
class TriState
3535
{
3636
public:
37-
TriState() noexcept;
38-
explicit TriState(bool input) noexcept;
37+
static constexpr TriState empty() noexcept
38+
{
39+
return TriState();
40+
}
41+
42+
public:
43+
constexpr TriState() noexcept;
44+
explicit constexpr TriState(bool input) noexcept;
3945

4046
bool operator ==(const TriState& o) const noexcept
4147
{
@@ -62,13 +68,13 @@ class TriState
6268
};
6369

6470
// The var is left uninitialized.
65-
inline TriState::TriState() noexcept
71+
inline constexpr TriState::TriState() noexcept
6672
: m_init(false), m_val(false)
6773
{
6874
}
6975

7076
// The var is initialized to the explicit value.
71-
inline TriState::TriState(bool input) noexcept
77+
inline constexpr TriState::TriState(bool input) noexcept
7278
: m_init(true), m_val(input)
7379
{
7480
}

src/dsql/parse.y

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,7 @@ sql_security_clause
23952395

23962396
%type <triState> sql_security_clause_opt
23972397
sql_security_clause_opt
2398-
: /* nothing */ { $$ = TriState(); }
2398+
: /* nothing */ { $$ = TriState::empty(); }
23992399
| sql_security_clause { $$ = $1; }
24002400
;
24012401

@@ -4244,7 +4244,7 @@ trigger_active
42444244
| INACTIVE
42454245
{ $$ = TriState(false); }
42464246
| // nothing
4247-
{ $$ = TriState(); }
4247+
{ $$ = TriState::empty(); }
42484248
;
42494249

42504250
%type <uint64Val> trigger_type(<createAlterTriggerNode>)
@@ -4590,7 +4590,7 @@ alter_op($relationNode)
45904590
}
45914591
| DROP SQL SECURITY
45924592
{
4593-
setClause($relationNode->ssDefiner, "SQL SECURITY", TriState());
4593+
setClause($relationNode->ssDefiner, "SQL SECURITY", TriState::empty());
45944594
RelationNode::Clause* clause =
45954595
newNode<RelationNode::Clause>(RelationNode::Clause::TYPE_ALTER_SQL_SECURITY);
45964596
$relationNode->clauses.add(clause);
@@ -6321,7 +6321,7 @@ optimize_clause
63216321
: OPTIMIZE optimize_mode
63226322
{ $$ = TriState($2); }
63236323
| // nothing
6324-
{ $$ = TriState(); }
6324+
{ $$ = TriState::empty(); }
63256325
;
63266326

63276327
%type <boolVal> optimize_mode

src/jrd/jrd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ JAttachment* JProvider::internalAttach(CheckStatusWrapper* user_status, const ch
18601860
// The actual FW mode (if different) will be fixed afterwards by PIO_header().
18611861

18621862
const TriState newForceWrite = options.dpb_set_force_write ?
1863-
TriState(options.dpb_force_write) : TriState();
1863+
TriState(options.dpb_force_write) : TriState::empty();
18641864

18651865
// Set the FW flag inside the database block to be considered by PIO routines
18661866
if (newForceWrite.valueOr(true))

src/jrd/pag_proto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool PAG_delete_clump_entry(Jrd::thread_db* tdbb, USHORT);
4545
void PAG_format_header(Jrd::thread_db*);
4646
void PAG_format_pip(Jrd::thread_db*, Jrd::PageSpace& pageSpace);
4747
bool PAG_get_clump(Jrd::thread_db*, USHORT, USHORT*, UCHAR*);
48-
void PAG_header(Jrd::thread_db*, bool, const Firebird::TriState newForceWrite = Firebird::TriState());
48+
void PAG_header(Jrd::thread_db*, bool, const Firebird::TriState newForceWrite = Firebird::TriState::empty());
4949
void PAG_header_init(Jrd::thread_db*);
5050
void PAG_init(Jrd::thread_db*);
5151
void PAG_init2(Jrd::thread_db*);

0 commit comments

Comments
 (0)