mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8300651: Replace NULL with nullptr in share/runtime/
Reviewed-by: rehn, dholmes
This commit is contained in:
parent
3c61d5aa48
commit
71107f4648
112 changed files with 2058 additions and 2058 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -80,8 +80,8 @@
|
|||
# include <signal.h>
|
||||
# include <errno.h>
|
||||
|
||||
OSThread* os::_starting_thread = NULL;
|
||||
address os::_polling_page = NULL;
|
||||
OSThread* os::_starting_thread = nullptr;
|
||||
address os::_polling_page = nullptr;
|
||||
volatile unsigned int os::_rand_seed = 1234567;
|
||||
int os::_processor_count = 0;
|
||||
int os::_initial_active_processor_count = 0;
|
||||
|
@ -111,7 +111,7 @@ int os::snprintf_checked(char* buf, size_t len, const char* fmt, ...) {
|
|||
|
||||
// Fill in buffer with current local time as an ISO-8601 string.
|
||||
// E.g., YYYY-MM-DDThh:mm:ss.mmm+zzzz.
|
||||
// Returns buffer, or NULL if it failed.
|
||||
// Returns buffer, or null if it failed.
|
||||
char* os::iso8601_time(char* buffer, size_t buffer_length, bool utc) {
|
||||
const jlong now = javaTimeMillis();
|
||||
return os::iso8601_time(now, buffer, buffer_length, utc);
|
||||
|
@ -119,7 +119,7 @@ char* os::iso8601_time(char* buffer, size_t buffer_length, bool utc) {
|
|||
|
||||
// Fill in buffer with an ISO-8601 string corresponding to the given javaTimeMillis value
|
||||
// E.g., yyyy-mm-ddThh:mm:ss-zzzz.
|
||||
// Returns buffer, or NULL if it failed.
|
||||
// Returns buffer, or null if it failed.
|
||||
// This would mostly be a call to
|
||||
// strftime(...., "%Y-%m-%d" "T" "%H:%M:%S" "%z", ....)
|
||||
// except that on Windows the %z behaves badly, so we do it ourselves.
|
||||
|
@ -129,13 +129,13 @@ char* os::iso8601_time(jlong milliseconds_since_19700101, char* buffer, size_t b
|
|||
// Output will be of the form "YYYY-MM-DDThh:mm:ss.mmm+zzzz\0"
|
||||
|
||||
// Sanity check the arguments
|
||||
if (buffer == NULL) {
|
||||
assert(false, "NULL buffer");
|
||||
return NULL;
|
||||
if (buffer == nullptr) {
|
||||
assert(false, "null buffer");
|
||||
return nullptr;
|
||||
}
|
||||
if (buffer_length < os::iso8601_timestamp_size) {
|
||||
assert(false, "buffer_length too small");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
const int milliseconds_per_microsecond = 1000;
|
||||
const time_t seconds_since_19700101 =
|
||||
|
@ -145,14 +145,14 @@ char* os::iso8601_time(jlong milliseconds_since_19700101, char* buffer, size_t b
|
|||
// Convert the time value to a tm and timezone variable
|
||||
struct tm time_struct;
|
||||
if (utc) {
|
||||
if (gmtime_pd(&seconds_since_19700101, &time_struct) == NULL) {
|
||||
if (gmtime_pd(&seconds_since_19700101, &time_struct) == nullptr) {
|
||||
assert(false, "Failed gmtime_pd");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
if (localtime_pd(&seconds_since_19700101, &time_struct) == NULL) {
|
||||
if (localtime_pd(&seconds_since_19700101, &time_struct) == nullptr) {
|
||||
assert(false, "Failed localtime_pd");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ char* os::iso8601_time(jlong milliseconds_since_19700101, char* buffer, size_t b
|
|||
zone_min);
|
||||
if (printed == 0) {
|
||||
assert(false, "Failed jio_printf");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ static bool conc_path_file_and_check(char *buffer, char *printbuffer, size_t pri
|
|||
static void free_array_of_char_arrays(char** a, size_t n) {
|
||||
while (n > 0) {
|
||||
n--;
|
||||
if (a[n] != NULL) {
|
||||
if (a[n] != nullptr) {
|
||||
FREE_C_HEAP_ARRAY(char, a[n]);
|
||||
}
|
||||
}
|
||||
|
@ -312,21 +312,21 @@ bool os::dll_locate_lib(char *buffer, size_t buflen,
|
|||
if (pnamelen == 0) {
|
||||
// If no path given, use current working directory.
|
||||
const char* p = get_current_directory(buffer, buflen);
|
||||
if (p != NULL) {
|
||||
if (p != nullptr) {
|
||||
const size_t plen = strlen(buffer);
|
||||
const char lastchar = buffer[plen - 1];
|
||||
retval = conc_path_file_and_check(buffer, &buffer[plen], buflen - plen,
|
||||
"", lastchar, fullfname);
|
||||
}
|
||||
} else if (strchr(pname, *os::path_separator()) != NULL) {
|
||||
} else if (strchr(pname, *os::path_separator()) != nullptr) {
|
||||
// A list of paths. Search for the path that contains the library.
|
||||
size_t n;
|
||||
char** pelements = split_path(pname, &n, fullfnamelen);
|
||||
if (pelements != NULL) {
|
||||
if (pelements != nullptr) {
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
char* path = pelements[i];
|
||||
// Really shouldn't be NULL, but check can't hurt.
|
||||
size_t plen = (path == NULL) ? 0 : strlen(path);
|
||||
// Really shouldn't be null, but check can't hurt.
|
||||
size_t plen = (path == nullptr) ? 0 : strlen(path);
|
||||
if (plen == 0) {
|
||||
continue; // Skip the empty path values.
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ static void signal_thread_entry(JavaThread* thread, TRAPS) {
|
|||
// Dispatch the signal to java
|
||||
HandleMark hm(THREAD);
|
||||
Klass* klass = SystemDictionary::resolve_or_null(vmSymbols::jdk_internal_misc_Signal(), THREAD);
|
||||
if (klass != NULL) {
|
||||
if (klass != nullptr) {
|
||||
JavaValue result(T_VOID);
|
||||
JavaCallArguments args;
|
||||
args.push_int(sig);
|
||||
|
@ -442,13 +442,13 @@ static void signal_thread_entry(JavaThread* thread, TRAPS) {
|
|||
// tty is initialized early so we don't expect it to be null, but
|
||||
// if it is we can't risk doing an initialization that might
|
||||
// trigger additional out-of-memory conditions
|
||||
if (tty != NULL) {
|
||||
if (tty != nullptr) {
|
||||
char klass_name[256];
|
||||
char tmp_sig_name[16];
|
||||
const char* sig_name = "UNKNOWN";
|
||||
InstanceKlass::cast(PENDING_EXCEPTION->klass())->
|
||||
name()->as_klass_external_name(klass_name, 256);
|
||||
if (os::exception_name(sig, tmp_sig_name, 16) != NULL)
|
||||
if (os::exception_name(sig, tmp_sig_name, 16) != nullptr)
|
||||
sig_name = tmp_sig_name;
|
||||
warning("Exception %s occurred dispatching signal %s to handler"
|
||||
"- the VM may need to be forcibly terminated",
|
||||
|
@ -499,10 +499,10 @@ void os::terminate_signal_thread() {
|
|||
typedef jint (JNICALL *JNI_OnLoad_t)(JavaVM *, void *);
|
||||
extern struct JavaVM_ main_vm;
|
||||
|
||||
static void* _native_java_library = NULL;
|
||||
static void* _native_java_library = nullptr;
|
||||
|
||||
void* os::native_java_library() {
|
||||
if (_native_java_library == NULL) {
|
||||
if (_native_java_library == nullptr) {
|
||||
char buffer[JVM_MAXPATHLEN];
|
||||
char ebuf[1024];
|
||||
|
||||
|
@ -511,7 +511,7 @@ void* os::native_java_library() {
|
|||
"java")) {
|
||||
_native_java_library = dll_load(buffer, ebuf, sizeof(ebuf));
|
||||
}
|
||||
if (_native_java_library == NULL) {
|
||||
if (_native_java_library == nullptr) {
|
||||
vm_exit_during_initialization("Unable to load native library", ebuf);
|
||||
}
|
||||
|
||||
|
@ -538,24 +538,24 @@ void* os::native_java_library() {
|
|||
*/
|
||||
void* os::find_agent_function(AgentLibrary *agent_lib, bool check_lib,
|
||||
const char *syms[], size_t syms_len) {
|
||||
assert(agent_lib != NULL, "sanity check");
|
||||
assert(agent_lib != nullptr, "sanity check");
|
||||
const char *lib_name;
|
||||
void *handle = agent_lib->os_lib();
|
||||
void *entryName = NULL;
|
||||
void *entryName = nullptr;
|
||||
char *agent_function_name;
|
||||
size_t i;
|
||||
|
||||
// If checking then use the agent name otherwise test is_static_lib() to
|
||||
// see how to process this lookup
|
||||
lib_name = ((check_lib || agent_lib->is_static_lib()) ? agent_lib->name() : NULL);
|
||||
lib_name = ((check_lib || agent_lib->is_static_lib()) ? agent_lib->name() : nullptr);
|
||||
for (i = 0; i < syms_len; i++) {
|
||||
agent_function_name = build_agent_function_name(syms[i], lib_name, agent_lib->is_absolute_path());
|
||||
if (agent_function_name == NULL) {
|
||||
if (agent_function_name == nullptr) {
|
||||
break;
|
||||
}
|
||||
entryName = dll_lookup(handle, agent_function_name);
|
||||
FREE_C_HEAP_ARRAY(char, agent_function_name);
|
||||
if (entryName != NULL) {
|
||||
if (entryName != nullptr) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -569,8 +569,8 @@ bool os::find_builtin_agent(AgentLibrary *agent_lib, const char *syms[],
|
|||
void *proc_handle;
|
||||
void *save_handle;
|
||||
|
||||
assert(agent_lib != NULL, "sanity check");
|
||||
if (agent_lib->name() == NULL) {
|
||||
assert(agent_lib != nullptr, "sanity check");
|
||||
if (agent_lib->name() == nullptr) {
|
||||
return false;
|
||||
}
|
||||
proc_handle = get_default_process_handle();
|
||||
|
@ -579,7 +579,7 @@ bool os::find_builtin_agent(AgentLibrary *agent_lib, const char *syms[],
|
|||
// We want to look in this process' symbol table.
|
||||
agent_lib->set_os_lib(proc_handle);
|
||||
ret = find_agent_function(agent_lib, true, syms, syms_len);
|
||||
if (ret != NULL) {
|
||||
if (ret != nullptr) {
|
||||
// Found an entry point like Agent_OnLoad_lib_name so we have a static agent
|
||||
agent_lib->set_valid();
|
||||
agent_lib->set_static_lib(true);
|
||||
|
@ -594,14 +594,14 @@ bool os::find_builtin_agent(AgentLibrary *agent_lib, const char *syms[],
|
|||
char *os::strdup(const char *str, MEMFLAGS flags) {
|
||||
size_t size = strlen(str);
|
||||
char *dup_str = (char *)malloc(size + 1, flags);
|
||||
if (dup_str == NULL) return NULL;
|
||||
if (dup_str == nullptr) return nullptr;
|
||||
strcpy(dup_str, str);
|
||||
return dup_str;
|
||||
}
|
||||
|
||||
char* os::strdup_check_oom(const char* str, MEMFLAGS flags) {
|
||||
char* p = os::strdup(str, flags);
|
||||
if (p == NULL) {
|
||||
if (p == nullptr) {
|
||||
vm_exit_out_of_memory(strlen(str) + 1, OOM_MALLOC_ERROR, "os::strdup_check_oom");
|
||||
}
|
||||
return p;
|
||||
|
@ -644,7 +644,7 @@ void* os::malloc(size_t size, MEMFLAGS flags) {
|
|||
void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) {
|
||||
|
||||
// Special handling for NMT preinit phase before arguments are parsed
|
||||
void* rc = NULL;
|
||||
void* rc = nullptr;
|
||||
if (NMTPreInit::handle_malloc(&rc, size)) {
|
||||
// No need to fill with 0 because DumpSharedSpaces doesn't use these
|
||||
// early allocations.
|
||||
|
@ -654,25 +654,25 @@ void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) {
|
|||
DEBUG_ONLY(check_crash_protection());
|
||||
|
||||
// On malloc(0), implementations of malloc(3) have the choice to return either
|
||||
// NULL or a unique non-NULL pointer. To unify libc behavior across our platforms
|
||||
// null or a unique non-null pointer. To unify libc behavior across our platforms
|
||||
// we chose the latter.
|
||||
size = MAX2((size_t)1, size);
|
||||
|
||||
// For the test flag -XX:MallocMaxTestWords
|
||||
if (has_reached_max_malloc_test_peak(size)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const size_t outer_size = size + MemTracker::overhead_per_malloc();
|
||||
|
||||
// Check for overflow.
|
||||
if (outer_size < size) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ALLOW_C_FUNCTION(::malloc, void* const outer_ptr = ::malloc(outer_size);)
|
||||
if (outer_ptr == NULL) {
|
||||
return NULL;
|
||||
if (outer_ptr == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void* const inner_ptr = MemTracker::record_malloc((address)outer_ptr, size, memflags, stack);
|
||||
|
@ -694,25 +694,25 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS flags) {
|
|||
void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCallStack& stack) {
|
||||
|
||||
// Special handling for NMT preinit phase before arguments are parsed
|
||||
void* rc = NULL;
|
||||
void* rc = nullptr;
|
||||
if (NMTPreInit::handle_realloc(&rc, memblock, size)) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (memblock == NULL) {
|
||||
if (memblock == nullptr) {
|
||||
return os::malloc(size, memflags, stack);
|
||||
}
|
||||
|
||||
DEBUG_ONLY(check_crash_protection());
|
||||
|
||||
// On realloc(p, 0), implementers of realloc(3) have the choice to return either
|
||||
// NULL or a unique non-NULL pointer. To unify libc behavior across our platforms
|
||||
// null or a unique non-null pointer. To unify libc behavior across our platforms
|
||||
// we chose the latter.
|
||||
size = MAX2((size_t)1, size);
|
||||
|
||||
// For the test flag -XX:MallocMaxTestWords
|
||||
if (has_reached_max_malloc_test_peak(size)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (MemTracker::enabled()) {
|
||||
|
@ -722,7 +722,7 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCa
|
|||
|
||||
// Handle size overflow.
|
||||
if (new_outer_size < size) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Perform integrity checks on and mark the old block as dead *before* calling the real realloc(3) since it
|
||||
|
@ -735,7 +735,7 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCa
|
|||
// the real realloc
|
||||
ALLOW_C_FUNCTION(::realloc, void* const new_outer_ptr = ::realloc(header, new_outer_size);)
|
||||
|
||||
if (new_outer_ptr == NULL) {
|
||||
if (new_outer_ptr == nullptr) {
|
||||
// realloc(3) failed and the block still exists.
|
||||
// We have however marked it as dead, revert this change.
|
||||
header->revive();
|
||||
|
@ -762,8 +762,8 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCa
|
|||
|
||||
// NMT disabled.
|
||||
ALLOW_C_FUNCTION(::realloc, rc = ::realloc(memblock, size);)
|
||||
if (rc == NULL) {
|
||||
return NULL;
|
||||
if (rc == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ void os::free(void *memblock) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (memblock == NULL) {
|
||||
if (memblock == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -860,7 +860,7 @@ void os::start_thread(Thread* thread) {
|
|||
}
|
||||
|
||||
void os::abort(bool dump_core) {
|
||||
abort(dump_core && CreateCoredumpOnCrash, NULL, NULL);
|
||||
abort(dump_core && CreateCoredumpOnCrash, nullptr, nullptr);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -876,7 +876,7 @@ bool os::print_function_and_library_name(outputStream* st,
|
|||
// (used during error handling; its a coin toss, really, if on-stack allocation
|
||||
// is worse than (raw) C-heap allocation in that case).
|
||||
char* p = buf;
|
||||
if (p == NULL) {
|
||||
if (p == nullptr) {
|
||||
p = (char*)::alloca(O_BUFLEN);
|
||||
buflen = O_BUFLEN;
|
||||
}
|
||||
|
@ -903,7 +903,7 @@ bool os::print_function_and_library_name(outputStream* st,
|
|||
// Print function name, optionally demangled
|
||||
if (demangle && strip_arguments) {
|
||||
char* args_start = strchr(p, '(');
|
||||
if (args_start != NULL) {
|
||||
if (args_start != nullptr) {
|
||||
*args_start = '\0';
|
||||
}
|
||||
}
|
||||
|
@ -924,7 +924,7 @@ bool os::print_function_and_library_name(outputStream* st,
|
|||
// Cut path parts
|
||||
if (shorten_paths) {
|
||||
char* p2 = strrchr(p, os::file_separator()[0]);
|
||||
if (p2 != NULL) {
|
||||
if (p2 != nullptr) {
|
||||
p = p2 + 1;
|
||||
}
|
||||
}
|
||||
|
@ -987,7 +987,7 @@ void os::print_dhm(outputStream* st, const char* startStr, long sec) {
|
|||
long days = sec/86400;
|
||||
long hours = (sec/3600) - (days * 24);
|
||||
long minutes = (sec/60) - (days * 1440) - (hours * 60);
|
||||
if (startStr == NULL) startStr = "";
|
||||
if (startStr == nullptr) startStr = "";
|
||||
st->print_cr("%s %ld days %ld:%02ld hours", startStr, days, hours, minutes);
|
||||
}
|
||||
|
||||
|
@ -1005,9 +1005,9 @@ void os::print_environment_variables(outputStream* st, const char** env_list) {
|
|||
if (env_list) {
|
||||
st->print_cr("Environment Variables:");
|
||||
|
||||
for (int i = 0; env_list[i] != NULL; i++) {
|
||||
for (int i = 0; env_list[i] != nullptr; i++) {
|
||||
char *envvar = ::getenv(env_list[i]);
|
||||
if (envvar != NULL) {
|
||||
if (envvar != nullptr) {
|
||||
st->print("%s", env_list[i]);
|
||||
st->print("=");
|
||||
st->print("%s", envvar);
|
||||
|
@ -1070,12 +1070,12 @@ void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
|
|||
char* timestring = ctime(&tloc); // ctime adds newline.
|
||||
// edit out the newline
|
||||
char* nl = strchr(timestring, '\n');
|
||||
if (nl != NULL) {
|
||||
if (nl != nullptr) {
|
||||
*nl = '\0';
|
||||
}
|
||||
|
||||
struct tm tz;
|
||||
if (localtime_pd(&tloc, &tz) != NULL) {
|
||||
if (localtime_pd(&tloc, &tz) != nullptr) {
|
||||
wchar_t w_buf[80];
|
||||
size_t n = ::wcsftime(w_buf, 80, L"%Z", &tz);
|
||||
if (n > 0) {
|
||||
|
@ -1106,7 +1106,7 @@ void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
|
|||
|
||||
|
||||
// Check if pointer can be read from (4-byte read access).
|
||||
// Helps to prove validity of a not-NULL pointer.
|
||||
// Helps to prove validity of a non-null pointer.
|
||||
// Returns true in very early stages of VM life when stub is not yet generated.
|
||||
bool os::is_readable_pointer(const void* p) {
|
||||
int* const aligned = (int*) align_down((intptr_t)p, 4);
|
||||
|
@ -1130,15 +1130,15 @@ bool os::is_readable_range(const void* from, const void* to) {
|
|||
// The verbose parameter is only set by the debug code in one case
|
||||
void os::print_location(outputStream* st, intptr_t x, bool verbose) {
|
||||
address addr = (address)x;
|
||||
// Handle NULL first, so later checks don't need to protect against it.
|
||||
if (addr == NULL) {
|
||||
st->print_cr("0x0 is NULL");
|
||||
// Handle null first, so later checks don't need to protect against it.
|
||||
if (addr == nullptr) {
|
||||
st->print_cr("0x0 is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if addr points into a code blob.
|
||||
CodeBlob* b = CodeCache::find_blob(addr);
|
||||
if (b != NULL) {
|
||||
if (b != nullptr) {
|
||||
b->dump_for_addr(addr, st, verbose);
|
||||
return;
|
||||
}
|
||||
|
@ -1330,7 +1330,7 @@ FILE* os::fopen(const char* path, const char* mode) {
|
|||
#if !(defined LINUX || defined BSD || defined _WINDOWS)
|
||||
// assume fcntl FD_CLOEXEC support as a backup solution when 'e' or 'N'
|
||||
// is not supported as mode in fopen
|
||||
if (file != NULL) {
|
||||
if (file != nullptr) {
|
||||
int fd = fileno(file);
|
||||
if (fd != -1) {
|
||||
int fd_flags = fcntl(fd, F_GETFD);
|
||||
|
@ -1352,7 +1352,7 @@ bool os::set_boot_path(char fileSep, char pathSep) {
|
|||
|
||||
// modular image if "modules" jimage exists
|
||||
char* jimage = format_boot_path("%/lib/" MODULES_IMAGE_NAME, home, home_len, fileSep, pathSep);
|
||||
if (jimage == NULL) return false;
|
||||
if (jimage == nullptr) return false;
|
||||
bool has_jimage = (os::stat(jimage, &st) == 0);
|
||||
if (has_jimage) {
|
||||
Arguments::set_boot_class_path(jimage, true);
|
||||
|
@ -1363,7 +1363,7 @@ bool os::set_boot_path(char fileSep, char pathSep) {
|
|||
|
||||
// check if developer build with exploded modules
|
||||
char* base_classes = format_boot_path("%/modules/" JAVA_BASE_NAME, home, home_len, fileSep, pathSep);
|
||||
if (base_classes == NULL) return false;
|
||||
if (base_classes == nullptr) return false;
|
||||
if (os::stat(base_classes, &st) == 0) {
|
||||
Arguments::set_boot_class_path(base_classes, false);
|
||||
FREE_C_HEAP_ARRAY(char, base_classes);
|
||||
|
@ -1376,7 +1376,7 @@ bool os::set_boot_path(char fileSep, char pathSep) {
|
|||
|
||||
bool os::file_exists(const char* filename) {
|
||||
struct stat statbuf;
|
||||
if (filename == NULL || strlen(filename) == 0) {
|
||||
if (filename == nullptr || strlen(filename) == 0) {
|
||||
return false;
|
||||
}
|
||||
return os::stat(filename, &statbuf) == 0;
|
||||
|
@ -1397,8 +1397,8 @@ bool os::file_exists(const char* filename) {
|
|||
// c> free up the data.
|
||||
char** os::split_path(const char* path, size_t* elements, size_t file_name_length) {
|
||||
*elements = (size_t)0;
|
||||
if (path == NULL || strlen(path) == 0 || file_name_length == (size_t)NULL) {
|
||||
return NULL;
|
||||
if (path == nullptr || strlen(path) == 0 || file_name_length == (size_t)nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
const char psepchar = *os::path_separator();
|
||||
char* inpath = NEW_C_HEAP_ARRAY(char, strlen(path) + 1, mtInternal);
|
||||
|
@ -1406,7 +1406,7 @@ char** os::split_path(const char* path, size_t* elements, size_t file_name_lengt
|
|||
size_t count = 1;
|
||||
char* p = strchr(inpath, psepchar);
|
||||
// Get a count of elements to allocate memory
|
||||
while (p != NULL) {
|
||||
while (p != nullptr) {
|
||||
count++;
|
||||
p++;
|
||||
p = strchr(p, psepchar);
|
||||
|
@ -1499,7 +1499,7 @@ void os::pause() {
|
|||
#if defined(_WINDOWS)
|
||||
Sleep(100);
|
||||
#else
|
||||
(void)::poll(NULL, 0, 100);
|
||||
(void)::poll(nullptr, 0, 100);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
|
@ -1737,7 +1737,7 @@ bool os::create_stack_guard_pages(char* addr, size_t bytes) {
|
|||
|
||||
char* os::reserve_memory(size_t bytes, bool executable, MEMFLAGS flags) {
|
||||
char* result = pd_reserve_memory(bytes, executable);
|
||||
if (result != NULL) {
|
||||
if (result != nullptr) {
|
||||
MemTracker::record_virtual_memory_reserve(result, bytes, CALLER_PC, flags);
|
||||
}
|
||||
return result;
|
||||
|
@ -1745,7 +1745,7 @@ char* os::reserve_memory(size_t bytes, bool executable, MEMFLAGS flags) {
|
|||
|
||||
char* os::attempt_reserve_memory_at(char* addr, size_t bytes, bool executable) {
|
||||
char* result = pd_attempt_reserve_memory_at(addr, bytes, executable);
|
||||
if (result != NULL) {
|
||||
if (result != nullptr) {
|
||||
MemTracker::record_virtual_memory_reserve((address)result, bytes, CALLER_PC);
|
||||
} else {
|
||||
log_debug(os)("Attempt to reserve memory at " INTPTR_FORMAT " for "
|
||||
|
@ -1862,9 +1862,9 @@ void os::pretouch_memory(void* start, void* end, size_t page_size) {
|
|||
char* os::map_memory_to_file(size_t bytes, int file_desc) {
|
||||
// Could have called pd_reserve_memory() followed by replace_existing_mapping_with_file_mapping(),
|
||||
// but AIX may use SHM in which case its more trouble to detach the segment and remap memory to the file.
|
||||
// On all current implementations NULL is interpreted as any available address.
|
||||
char* result = os::map_memory_to_file(NULL /* addr */, bytes, file_desc);
|
||||
if (result != NULL) {
|
||||
// On all current implementations null is interpreted as any available address.
|
||||
char* result = os::map_memory_to_file(nullptr /* addr */, bytes, file_desc);
|
||||
if (result != nullptr) {
|
||||
MemTracker::record_virtual_memory_reserve_and_commit(result, bytes, CALLER_PC);
|
||||
}
|
||||
return result;
|
||||
|
@ -1872,7 +1872,7 @@ char* os::map_memory_to_file(size_t bytes, int file_desc) {
|
|||
|
||||
char* os::attempt_map_memory_to_file_at(char* addr, size_t bytes, int file_desc) {
|
||||
char* result = pd_attempt_map_memory_to_file_at(addr, bytes, file_desc);
|
||||
if (result != NULL) {
|
||||
if (result != nullptr) {
|
||||
MemTracker::record_virtual_memory_reserve_and_commit((address)result, bytes, CALLER_PC);
|
||||
}
|
||||
return result;
|
||||
|
@ -1882,7 +1882,7 @@ char* os::map_memory(int fd, const char* file_name, size_t file_offset,
|
|||
char *addr, size_t bytes, bool read_only,
|
||||
bool allow_exec, MEMFLAGS flags) {
|
||||
char* result = pd_map_memory(fd, file_name, file_offset, addr, bytes, read_only, allow_exec);
|
||||
if (result != NULL) {
|
||||
if (result != nullptr) {
|
||||
MemTracker::record_virtual_memory_reserve_and_commit((address)result, bytes, CALLER_PC, flags);
|
||||
}
|
||||
return result;
|
||||
|
@ -1923,7 +1923,7 @@ char* os::reserve_memory_special(size_t size, size_t alignment, size_t page_size
|
|||
assert(is_aligned(addr, alignment), "Unaligned request address");
|
||||
|
||||
char* result = pd_reserve_memory_special(size, alignment, page_size, addr, executable);
|
||||
if (result != NULL) {
|
||||
if (result != nullptr) {
|
||||
// The memory is committed
|
||||
MemTracker::record_virtual_memory_reserve_and_commit((address)result, size, CALLER_PC);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue