Skip to content

Commit 0b3d492

Browse files
committed
Move constant expressions to left-hand-side of conditional comparisons
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
1 parent af5f91f commit 0b3d492

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/large_pages/node_large_page.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,16 @@ bool IsTransparentHugePagesEnabled() {
262262
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/huge_memory.c?id=13391c60da3308ed9980de0168f74cce6c62ac1d#n163
263263
const char* filename = "/sys/kernel/mm/transparent_hugepage/enabled";
264264
std::ifstream config_stream(filename, std::ios::in);
265-
if (config_stream.good() == false) {
265+
if (false == config_stream.good()) {
266266
PrintWarning("could not open /sys/kernel/mm/transparent_hugepage/enabled");
267267
return false;
268268
}
269269

270270
std::string token;
271271
config_stream >> token;
272-
if (token == "[always]") return true;
272+
if ("[always]" == token) return true;
273273
config_stream >> token;
274-
if (token == "[madvise]") return true;
274+
if ("[madvise]" == token) return true;
275275
return false;
276276
}
277277
#elif defined(__FreeBSD__)

0 commit comments

Comments
 (0)