8379346: Cleanup casts and implicit conversions to boolean

Reviewed-by: stefank, dholmes, ayang
This commit is contained in:
Leo Korinth 2026-03-26 18:16:17 +00:00
parent aecc16358f
commit 72176305ae
2 changed files with 6 additions and 6 deletions

View File

@ -68,7 +68,7 @@ static size_t scan_default_hugepagesize() {
// format has been changed), we'll set largest page size to 0
FILE *fp = os::fopen("/proc/meminfo", "r");
if (fp) {
if (fp != nullptr) {
while (!feof(fp)) {
int x = 0;
char buf[16];
@ -81,7 +81,7 @@ static size_t scan_default_hugepagesize() {
// skip to next line
for (;;) {
int ch = fgetc(fp);
if (ch == EOF || ch == (int)'\n') break;
if (ch == EOF || ch == '\n') break;
}
}
}

View File

@ -1313,7 +1313,7 @@ bool os::is_primordial_thread(void) {
// Find the virtual memory area that contains addr
static bool find_vma(address addr, address* vma_low, address* vma_high) {
FILE *fp = os::fopen("/proc/self/maps", "r");
if (fp) {
if (fp != nullptr) {
address low, high;
while (!feof(fp)) {
if (fscanf(fp, "%p-%p", &low, &high) == 2) {
@ -1326,7 +1326,7 @@ static bool find_vma(address addr, address* vma_low, address* vma_high) {
}
for (;;) {
int ch = fgetc(fp);
if (ch == EOF || ch == (int)'\n') break;
if (ch == EOF || ch == '\n') break;
}
}
fclose(fp);
@ -4384,7 +4384,7 @@ int os::Linux::get_namespace_pid(int vmid) {
os::snprintf_checked(fname, sizeof(fname), "/proc/%d/status", vmid);
FILE *fp = os::fopen(fname, "r");
if (fp) {
if (fp != nullptr) {
int pid, nspid;
int ret;
while (!feof(fp) && !ferror(fp)) {
@ -4398,7 +4398,7 @@ int os::Linux::get_namespace_pid(int vmid) {
}
for (;;) {
int ch = fgetc(fp);
if (ch == EOF || ch == (int)'\n') break;
if (ch == EOF || ch == '\n') break;
}
}
fclose(fp);