11/*
2- * Copyright (c) 2000, 2022 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2000, 2024 , 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
3838
3939bool JavaAssertions::_userDefault = false ;
4040bool JavaAssertions::_sysDefault = false ;
41- JavaAssertions::OptionList* JavaAssertions::_classes = 0 ;
42- JavaAssertions::OptionList* JavaAssertions::_packages = 0 ;
41+ JavaAssertions::OptionList* JavaAssertions::_classes = nullptr ;
42+ JavaAssertions::OptionList* JavaAssertions::_packages = nullptr ;
4343
4444JavaAssertions::OptionList::OptionList (const char * name, bool enabled,
4545 OptionList* next) {
46- assert (name != 0 , " need a name" );
46+ assert (name != nullptr , " need a name" );
4747 _name = name;
4848 _enabled = enabled;
4949 _next = next;
5050}
5151
5252int JavaAssertions::OptionList::count (OptionList* p) {
5353 int rc;
54- for (rc = 0 ; p != 0 ; p = p->next (), ++rc) /* empty */ ;
54+ for (rc = 0 ; p != nullptr ; p = p->next (), ++rc) /* empty */ ;
5555 return rc;
5656}
5757
5858void JavaAssertions::addOption (const char * name, bool enable) {
59- assert (name != 0 , " must have a name" );
59+ assert (name != nullptr , " must have a name" );
6060
6161 // Copy the name. The storage needs to exist for the lifetime of the vm;
6262 // it is never freed, so will be leaked (along with other option strings -
@@ -135,7 +135,7 @@ void JavaAssertions::fillJavaArrays(const OptionList* p, int len,
135135 // matches the order on the command line (the list is in reverse order, since
136136 // it was created by prepending successive items from the command line).
137137 int index;
138- for (index = len - 1 ; p != 0 ; p = p->next (), --index) {
138+ for (index = len - 1 ; p != nullptr ; p = p->next (), --index) {
139139 assert (index >= 0 , " length does not match list" );
140140 TempNewSymbol name = SymbolTable::new_symbol (p->name ());
141141 Handle s = java_lang_String::externalize_classname (name, CHECK);
@@ -147,20 +147,20 @@ void JavaAssertions::fillJavaArrays(const OptionList* p, int len,
147147
148148inline JavaAssertions::OptionList*
149149JavaAssertions::match_class (const char * classname) {
150- for (OptionList* p = _classes; p != 0 ; p = p->next ()) {
150+ for (OptionList* p = _classes; p != nullptr ; p = p->next ()) {
151151 if (strcmp (p->name (), classname) == 0 ) {
152152 return p;
153153 }
154154 }
155- return 0 ;
155+ return nullptr ;
156156}
157157
158158JavaAssertions::OptionList*
159159JavaAssertions::match_package (const char * classname) {
160160 // Search the package list for any items that apply to classname. Each
161161 // sub-package in classname is checked, from most-specific to least, until one
162162 // is found.
163- if (_packages == 0 ) return 0 ;
163+ if (_packages == nullptr ) return nullptr ;
164164
165165 // Find the length of the "most-specific" package in classname. If classname
166166 // does not include a package, length will be 0 which will match items for the
@@ -170,7 +170,7 @@ JavaAssertions::match_package(const char* classname) {
170170
171171 do {
172172 assert (len == 0 || classname[len] == JVM_SIGNATURE_SLASH, " not a package name" );
173- for (OptionList* p = _packages; p != 0 ; p = p->next ()) {
173+ for (OptionList* p = _packages; p != nullptr ; p = p->next ()) {
174174 if (strncmp (p->name (), classname, len) == 0 && p->name ()[len] == ' \0 ' ) {
175175 return p;
176176 }
@@ -181,7 +181,7 @@ JavaAssertions::match_package(const char* classname) {
181181 while (len > 0 && classname[--len] != JVM_SIGNATURE_SLASH) /* empty */ ;
182182 } while (len > 0 );
183183
184- return 0 ;
184+ return nullptr ;
185185}
186186
187187inline void JavaAssertions::trace (const char * name,
@@ -193,7 +193,7 @@ const char* typefound, const char* namefound, bool enabled) {
193193}
194194
195195bool JavaAssertions::enabled (const char * classname, bool systemClass) {
196- assert (classname != 0 , " must have a classname" );
196+ assert (classname != nullptr , " must have a classname" );
197197
198198 // This will be slow if the number of assertion options on the command line is
199199 // large--it traverses two lists, one of them multiple times. Could use a
0 commit comments