RFR: JDK-8301076: Replace NULL with nullptr in share/prims/ [v2]
David Holmes
dholmes at openjdk.org
Tue Jan 31 02:26:02 UTC 2023
On Mon, 30 Jan 2023 09:30:36 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory share/prims/. Unfortunately the script that does the change isn't perfect, and so we
>> need to comb through these manually to make sure nothing has gone wrong. I also review these changes but things slip past my eyes sometimes.
>>
>> Here are some typical things to look out for:
>>
>> 1. No changes but copyright header changed (probably because I reverted some changes but forgot the copyright).
>> 2. Macros having their NULL changed to nullptr, these are added to the script when I find them. They should be NULL.
>> 3. nullptr in comments and logs. We try to use lower case "null" in these cases as it reads better. An exception is made when code expressions are in a comment.
>>
>> An example of this:
>>
>> ```c++
>> // This function returns null
>> void* ret_null();
>> // This function returns true if *x == nullptr
>> bool is_nullptr(void** x);
>>
>>
>> Note how `nullptr` participates in a code expression here, we really are talking about the specific value `nullptr`.
>>
>> Thanks!
>
> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
>
> FIx suggested changes
A few adjustments but overall looks good. Thanks.
src/hotspot/share/prims/jni.cpp line 2166:
> 2164: bool is_latin1 = java_lang_String::is_latin1(s);
> 2165: buf = NEW_C_HEAP_ARRAY_RETURN_NULL(jchar, s_len + 1, mtInternal); // add one for zero termination
> 2166: /* JNI Specification states return nullptr on OOM */
null
src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp line 56:
> 54: // collector.collect();
> 55: // JvmtiCodeBlobDesc* blob = collector.first();
> 56: // while (blob != null) {
nullptr
src/hotspot/share/prims/jvmtiEnv.cpp line 581:
> 579:
> 580: if (event_thread == nullptr) {
> 581: // Can be called at Agent_OnLoad() time with event_thread == null
nullptr
src/hotspot/share/prims/jvmtiEnvBase.hpp line 170:
> 168: };
> 169:
> 170: // If (thread == null) then return current thread object.
nullptr
src/hotspot/share/prims/jvmtiEnvBase.hpp line 184:
> 182: oop cur_obj = current->jvmti_vthread();
> 183:
> 184: // cur_obj == null is true for normal platform threads only
nullptr
src/hotspot/share/prims/jvmtiEventController.hpp line 214:
> 212:
> 213: // Use (thread == null) to enable/disable an event globally.
> 214: // Use (thread != null) to enable/disable an event for a particular thread.
nullptr
-------------
Marked as reviewed by dholmes (Reviewer).
PR: https://git.openjdk.org/jdk/pull/12188
More information about the serviceability-dev
mailing list