Skip to content

Commit

Permalink
Move constant expressions to left-hand-side of conditional comparisons
Browse files Browse the repository at this point in the history
These constant expressions are read-only; a single-character typo or other mistake leading to the equality operator becoming an assignment operator would therefore be caught at compile-time by applying this change
  • Loading branch information
jayaddison committed Feb 6, 2021
1 parent af5f91f commit 0b3d492
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/large_pages/node_large_page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,16 @@ bool IsTransparentHugePagesEnabled() {
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/huge_memory.c?id=13391c60da3308ed9980de0168f74cce6c62ac1d#n163
const char* filename = "/sys/kernel/mm/transparent_hugepage/enabled";
std::ifstream config_stream(filename, std::ios::in);
if (config_stream.good() == false) {
if (false == config_stream.good()) {
PrintWarning("could not open /sys/kernel/mm/transparent_hugepage/enabled");
return false;
}

std::string token;
config_stream >> token;
if (token == "[always]") return true;
if ("[always]" == token) return true;
config_stream >> token;
if (token == "[madvise]") return true;
if ("[madvise]" == token) return true;
return false;
}
#elif defined(__FreeBSD__)
Expand Down

0 comments on commit 0b3d492

Please sign in to comment.