Skip to content

Commit

Permalink
include/nutconf.hpp: BoolInt: avoid "if (b)" constructs in favor of e…
Browse files Browse the repository at this point in the history
…xplicit call to operator via "if (b == true)" [networkupstools#2294]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Apr 29, 2024
1 parent e7af979 commit 60cc7a2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/nutconf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,10 @@ class BoolInt
if (i.set()) return i;
if (bool01.set() && bool01 == true) {
if (b.set()) {
if (b) return 1;
/** Cause use of operator to avoid warnings like
* "may be used uninitialized in this function"
*/
if (b == true) return 1;
return 0;
}
} else {
Expand Down Expand Up @@ -447,7 +450,7 @@ class BoolInt

inline std::string toString()const {
if (b.set()) {
if (b) return "yes";
if (b == true) return "yes";
return "no";
}

Expand Down

0 comments on commit 60cc7a2

Please sign in to comment.