Skip to content

Commit b0376a5

Browse files
committed
8301069: Replace NULL with nullptr in share/libadt/
Reviewed-by: kvn
1 parent 7328182 commit b0376a5

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/hotspot/share/libadt/dict.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -141,7 +141,7 @@ void Dict::doubhash() {
141141
//------------------------------Insert----------------------------------------
142142
// Insert or replace a key/value pair in the given dictionary. If the
143143
// dictionary is too full, it's size is doubled. The prior value being
144-
// replaced is returned (NULL if this is a 1st insertion of that key). If
144+
// replaced is returned (null if this is a 1st insertion of that key). If
145145
// an old value is found, it's swapped with the prior key-value pair on the
146146
// list. This moves a commonly searched-for value towards the list head.
147147
void*Dict::Insert(void* key, void* val, bool replace) {
@@ -177,7 +177,7 @@ void*Dict::Insert(void* key, void* val, bool replace) {
177177
b->_keyvals[b->_cnt + b->_cnt ] = key;
178178
b->_keyvals[b->_cnt + b->_cnt + 1] = val;
179179
b->_cnt++;
180-
return NULL; // Nothing found prior
180+
return nullptr; // Nothing found prior
181181
}
182182

183183
//------------------------------Delete---------------------------------------
@@ -195,11 +195,11 @@ void* Dict::Delete(void* key) {
195195
return prior;
196196
}
197197
}
198-
return NULL;
198+
return nullptr;
199199
}
200200

201201
//------------------------------FindDict-------------------------------------
202-
// Find a key-value pair in the given dictionary. If not found, return NULL.
202+
// Find a key-value pair in the given dictionary. If not found, return null.
203203
// If found, move key-value pair towards head of list.
204204
void* Dict::operator [](const void* key) const {
205205
uint i = _hash(key) & (_size - 1); // Get hash key, corrected for size
@@ -209,7 +209,7 @@ void* Dict::operator [](const void* key) const {
209209
return b->_keyvals[j + j + 1];
210210
}
211211
}
212-
return NULL;
212+
return nullptr;
213213
}
214214

215215
//------------------------------print------------------------------------------
@@ -287,7 +287,7 @@ void DictI::reset(const Dict* dict) {
287287
}
288288

289289
//------------------------------next-------------------------------------------
290-
// Find the next key-value pair in the dictionary, or return a NULL key and
290+
// Find the next key-value pair in the dictionary, or return a null key and
291291
// value.
292292
void DictI::operator ++(void) {
293293
if (_j--) { // Still working in current bin?
@@ -306,5 +306,5 @@ void DictI::operator ++(void) {
306306
_value = _d->_bin[_i]._keyvals[_j+_j+1];
307307
return;
308308
}
309-
_key = _value = NULL;
309+
_key = _value = nullptr;
310310
}

src/hotspot/share/libadt/dict.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -65,11 +65,11 @@ class Dict : public AnyObj { // Dictionary structure
6565
uint32_t Size(void) const { return _cnt; }
6666

6767
// Insert inserts the given key-value pair into the dictionary. The prior
68-
// value of the key is returned; NULL if the key was not previously defined.
68+
// value of the key is returned; null if the key was not previously defined.
6969
void* Insert(void* key, void* val, bool replace = true); // A new key-value
7070
void* Delete(void* key); // Delete & return old
7171

72-
// Find finds the value of a given key; or NULL if not found.
72+
// Find finds the value of a given key; or null if not found.
7373
// The dictionary is NOT changed.
7474
void* operator [](const void* key) const; // Do a lookup
7575

0 commit comments

Comments
 (0)