From 4176d8a02cf22bd6705e9504112152f13e7d15c6 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Thu, 30 Mar 2023 19:28:28 +0000 Subject: [PATCH] [vm] Update NULL to nullptr in runtime/lib. TEST=build Change-Id: I883dd0516519b175eb15b530776499248a3e0759 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292061 Reviewed-by: Alexander Aprelev Commit-Queue: Ryan Macnak --- runtime/lib/async.cc | 2 +- runtime/lib/errors.cc | 2 +- runtime/lib/integers.cc | 4 ++-- runtime/lib/isolate.cc | 16 ++++++++-------- runtime/lib/libgen_in.cc | 2 +- runtime/lib/math.cc | 2 +- runtime/lib/mirrors.cc | 2 +- runtime/lib/object.cc | 2 +- runtime/lib/stacktrace.cc | 4 ++-- runtime/lib/string.cc | 2 +- runtime/lib/timeline.cc | 4 ++-- runtime/lib/vmservice.cc | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/runtime/lib/async.cc b/runtime/lib/async.cc index f2e539bd171..dc4f71d1554 100644 --- a/runtime/lib/async.cc +++ b/runtime/lib/async.cc @@ -15,7 +15,7 @@ DEFINE_NATIVE_ENTRY(AsyncStarMoveNext_debuggerStepCheck, 0, 1) { #if !defined(PRODUCT) GET_NON_NULL_NATIVE_ARGUMENT(Closure, async_op, arguments->NativeArgAt(0)); Debugger* debugger = isolate->debugger(); - if (debugger != NULL) { + if (debugger != nullptr) { debugger->MaybeAsyncStepInto(async_op); } #endif diff --git a/runtime/lib/errors.cc b/runtime/lib/errors.cc index 8534c748f7f..d4a4759f147 100644 --- a/runtime/lib/errors.cc +++ b/runtime/lib/errors.cc @@ -30,7 +30,7 @@ static ScriptPtr FindScript(DartFrameIterator* iterator) { Class::Handle(Library::LookupCoreClass(Symbols::AssertionError())); ASSERT(!assert_error_class.IsNull()); bool hit_assertion_error = false; - for (; stack_frame != NULL; stack_frame = iterator->NextFrame()) { + for (; stack_frame != nullptr; stack_frame = iterator->NextFrame()) { code = stack_frame->LookupDartCode(); if (code.is_optimized()) { InlinedFunctionsIterator inlined_iterator(code, stack_frame->pc()); diff --git a/runtime/lib/integers.cc b/runtime/lib/integers.cc index 6efb724afc2..b033b14c2ee 100644 --- a/runtime/lib/integers.cc +++ b/runtime/lib/integers.cc @@ -166,8 +166,8 @@ static IntegerPtr ParseInteger(const String& value) { const intptr_t len = value.Length(); if (len > 0) { const char* cstr = value.ToCString(); - ASSERT(cstr != NULL); - char* p_end = NULL; + ASSERT(cstr != nullptr); + char* p_end = nullptr; const int64_t int_value = strtoll(cstr, &p_end, 10); if (p_end == (cstr + len)) { if ((int_value != LLONG_MIN) && (int_value != LLONG_MAX)) { diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc index e1502ada239..108e40fb4ac 100644 --- a/runtime/lib/isolate.cc +++ b/runtime/lib/isolate.cc @@ -579,7 +579,7 @@ ObjectPtr IsolateSpawnState::ResolveFunction() { } static ObjectPtr DeserializeMessage(Thread* thread, Message* message) { - if (message == NULL) { + if (message == nullptr) { return Object::null(); } if (message->IsRaw()) { @@ -936,9 +936,9 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 0, 10) { /*same_group=*/true, message, ILLEGAL_PORT, Message::kNormalPriority)); const char* utf8_package_config = - packageConfig.IsNull() ? NULL : String2UTF8(packageConfig); + packageConfig.IsNull() ? nullptr : String2UTF8(packageConfig); const char* utf8_debug_name = - debugName.IsNull() ? NULL : String2UTF8(debugName); + debugName.IsNull() ? nullptr : String2UTF8(debugName); if (closure_tuple_handle != nullptr && utf8_debug_name == nullptr) { const auto& closure_function = Function::Handle(zone, closure.function()); utf8_debug_name = @@ -963,7 +963,7 @@ static const char* CanonicalizeUri(Thread* thread, const Library& library, const String& uri, char** error) { - const char* result = NULL; + const char* result = nullptr; Zone* zone = thread->zone(); auto isolate_group = thread->isolate_group(); if (isolate_group->HasTagHandler()) { @@ -1024,17 +1024,17 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnUri, 0, 12) { // Canonicalize the uri with respect to the current isolate. const Library& root_lib = Library::Handle(isolate->group()->object_store()->root_library()); - char* error = NULL; + char* error = nullptr; const char* canonical_uri = CanonicalizeUri(thread, root_lib, uri, &error); - if (canonical_uri == NULL) { + if (canonical_uri == nullptr) { const String& msg = String::Handle(String::New(error)); ThrowIsolateSpawnException(msg); } const char* utf8_package_config = - packageConfig.IsNull() ? NULL : String2UTF8(packageConfig); + packageConfig.IsNull() ? nullptr : String2UTF8(packageConfig); const char* utf8_debug_name = - debugName.IsNull() ? NULL : String2UTF8(debugName); + debugName.IsNull() ? nullptr : String2UTF8(debugName); std::unique_ptr state(new IsolateSpawnState( port.Id(), canonical_uri, utf8_package_config, &arguments_buffer, diff --git a/runtime/lib/libgen_in.cc b/runtime/lib/libgen_in.cc index cc74faa19f8..6531269409a 100644 --- a/runtime/lib/libgen_in.cc +++ b/runtime/lib/libgen_in.cc @@ -12,5 +12,5 @@ const char* {{VAR_NAME}}[] = { {{LIBRARY_SOURCE_MAP}} {{PART_SOURCE_MAP}} - NULL, NULL, NULL + nullptr, nullptr, nullptr }; diff --git a/runtime/lib/math.cc b/runtime/lib/math.cc index d13b2efad15..384c512175b 100644 --- a/runtime/lib/math.cc +++ b/runtime/lib/math.cc @@ -35,7 +35,7 @@ DEFINE_NATIVE_ENTRY(SecureRandom_getBytes, 0, 1) { ASSERT((n > 0) && (n <= 8)); uint8_t buffer[8]; Dart_EntropySource entropy_source = Dart::entropy_source_callback(); - if ((entropy_source == NULL) || !entropy_source(buffer, n)) { + if ((entropy_source == nullptr) || !entropy_source(buffer, n)) { const String& error = String::Handle(String::New( "No source of cryptographically secure random numbers available.")); const Array& args = Array::Handle(Array::New(1)); diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc index 3529c3d1881..e13f4129da1 100644 --- a/runtime/lib/mirrors.cc +++ b/runtime/lib/mirrors.cc @@ -1417,7 +1417,7 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invokeConstructor, 0, 5) { ArgumentsDescriptor::NewBoxed(kTypeArgsLen, args.Length(), arg_names)); ArgumentsDescriptor args_descriptor(args_descriptor_array); - if (!lookup_constructor.AreValidArguments(args_descriptor, NULL)) { + if (!lookup_constructor.AreValidArguments(args_descriptor, nullptr)) { external_constructor_name = lookup_constructor.name(); ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), external_constructor_name, explicit_args, arg_names, diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc index 13511b3a68e..a2282428cf9 100644 --- a/runtime/lib/object.cc +++ b/runtime/lib/object.cc @@ -560,7 +560,7 @@ DEFINE_NATIVE_ENTRY(Internal_boundsCheckForPartialInstantiation, 0, 2) { DartFrameIterator iterator(Thread::Current(), StackFrameIterator::kNoCrossThreadIteration); StackFrame* caller_frame = iterator.NextFrame(); - ASSERT(caller_frame != NULL); + ASSERT(caller_frame != nullptr); location = caller_frame->GetTokenPos(); } const auto& parameter_name = String::Handle(zone, type_params.NameAt(i)); diff --git a/runtime/lib/stacktrace.cc b/runtime/lib/stacktrace.cc index af80ae5509d..1af74215635 100644 --- a/runtime/lib/stacktrace.cc +++ b/runtime/lib/stacktrace.cc @@ -67,9 +67,9 @@ static void AppendFrames(const GrowableObjectArray& code_list, StackFrameIterator frames(ValidationPolicy::kDontValidateFrames, thread, StackFrameIterator::kNoCrossThreadIteration); StackFrame* frame = frames.NextFrame(); - ASSERT(frame != NULL); // We expect to find a dart invocation frame. + ASSERT(frame != nullptr); // We expect to find a dart invocation frame. Code& code = Code::Handle(zone); - for (; frame != NULL; frame = frames.NextFrame()) { + for (; frame != nullptr; frame = frames.NextFrame()) { if (!frame->IsDartFrame()) { continue; } diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc index ad611b76ed2..a5483d075e0 100644 --- a/runtime/lib/string.cc +++ b/runtime/lib/string.cc @@ -44,7 +44,7 @@ DEFINE_NATIVE_ENTRY(StringBase_createFromCodePoints, 0, 3) { length = a.Length(); } else { Exceptions::ThrowArgumentError(list); - return NULL; // Unreachable. + return nullptr; // Unreachable. } intptr_t start = start_obj.Value(); diff --git a/runtime/lib/timeline.cc b/runtime/lib/timeline.cc index 38364eeab82..e90b730061b 100644 --- a/runtime/lib/timeline.cc +++ b/runtime/lib/timeline.cc @@ -44,12 +44,12 @@ DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 0, 4) { GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(3)); TimelineEventRecorder* recorder = Timeline::recorder(); - if (recorder == NULL) { + if (recorder == nullptr) { return Object::null(); } TimelineEvent* event = Timeline::GetDartStream()->StartEvent(); - if (event == NULL) { + if (event == nullptr) { // Stream was turned off. return Object::null(); } diff --git a/runtime/lib/vmservice.cc b/runtime/lib/vmservice.cc index e544842f78a..f2c9a5d3355 100644 --- a/runtime/lib/vmservice.cc +++ b/runtime/lib/vmservice.cc @@ -120,7 +120,7 @@ DEFINE_NATIVE_ENTRY(VMService_OnServerAddressChange, 0, 1) { #ifndef PRODUCT GET_NATIVE_ARGUMENT(String, address, arguments->NativeArgAt(0)); if (address.IsNull()) { - ServiceIsolate::SetServerAddress(NULL); + ServiceIsolate::SetServerAddress(nullptr); } else { ServiceIsolate::SetServerAddress(address.ToCString()); }