In `hugepages.cpp` and `os_linux.cpp`, at least three functions use more or less copy pasted code that do not follow our guidelines. These functions read from text files and uses code like `if (fp)` instead of `if (fp != nullptr)` and added unnecessary cast from char to int `if (ch == EOF || ch == (int)'\n') break; `.
Improve these problems, but also try to refactor the code to use a common function that opens a file and reads the first matching `fscanf` pattern (or something similar).
Improve these problems, but also try to refactor the code to use a common function that opens a file and reads the first matching `fscanf` pattern (or something similar).