Skip to content

Commit

Permalink
Fix #165: isenabled was misnamed and wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
terrillmoore committed Apr 21, 2019
1 parent 5a1392b commit 43b2da6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ isReplicated KEYWORD2
isStandard KEYWORD2
isValid KEYWORD2
isbound KEYWORD2
isenabled KEYWORD2
isEnabled KEYWORD2
islocated KEYWORD2
locate KEYWORD2
loop KEYWORD2
Expand Down
17 changes: 12 additions & 5 deletions src/Catena_Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,22 @@ class cLog
this->m_uDebugFlags = uDebugFlags;
}

// check whether flags are enabled ... inline for speed
// old, incorrect polarity: return false if isEnabled() is true..
[[deprecated("use isEnabled(), check polarities; see issue #165")]]
bool isenabled(DebugFlags uDebugFlags) const
{
return ((uDebugFlags & this->m_uDebugFlags) == 0 &&
uDebugFlags != kAlways &&
uDebugFlags != kFatal);
return !this->isEnabled(uDebugFlags);
}

// check whether flags are enabled ... inline for speed
bool isEnabled(DebugFlags uDebugFlags) const
{
return ((uDebugFlags & this->m_uDebugFlags) != 0 ||
uDebugFlags == kAlways ||
uDebugFlags == kFatal);
}

// log
// log, using debug flags. Note that args are evaluated even if no print.
void printf(
DebugFlags uDebugFlags,
const char *pFmt,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Catena_Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ cLog::printf(
return;

// either inbound mask must be zero or must match
if (this->isenabled(uDebugFlags))
if (! this->isEnabled(uDebugFlags))
return;

char buf[128];
Expand Down

0 comments on commit 43b2da6

Please sign in to comment.