From d8d4e95697500908f73edf122c0c09ef6c9a80ef Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Thu, 23 Dec 2021 10:19:22 -0800 Subject: [PATCH] Enable modernize-use-nullptr clang tidy rule Summary: changelog: [internal] You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html Reviewed By: rubennorte Differential Revision: D33296118 fbshipit-source-id: ba9de4611c0f0459db9cea56722385e2541b155e --- ReactCommon/react/renderer/.clang-tidy | 1 + .../renderer/components/view/YogaLayoutableShadowNode.cpp | 2 +- .../react/renderer/textlayoutmanager/TextLayoutManager.cpp | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ReactCommon/react/renderer/.clang-tidy b/ReactCommon/react/renderer/.clang-tidy index 1f9babb38a9..8adc91342a1 100644 --- a/ReactCommon/react/renderer/.clang-tidy +++ b/ReactCommon/react/renderer/.clang-tidy @@ -21,5 +21,6 @@ modernize-unary-static-assert, modernize-use-emplace, modernize-shrink-to-fit, modernize-use-equals-default, +modernize-use-nullptr, ' ... diff --git a/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp b/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp index 0c5ccdf083c..e3949b3bda3 100644 --- a/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +++ b/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp @@ -33,7 +33,7 @@ static int FabricDefaultYogaLog( va_copy(args_copy, args); // Adding 1 to add space for terminating null character. - int size_s = vsnprintf(NULL, 0, format, args); + int size_s = vsnprintf(nullptr, 0, format, args); auto size = static_cast(size_s); std::vector buffer(size); diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp b/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp index 24db520f337..8b0241cae62 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp @@ -219,7 +219,8 @@ TextMeasurement TextLayoutManager::doMeasure( maximumSize.height, attachmentPositions); - jfloat *attachmentData = env->GetFloatArrayElements(attachmentPositions, 0); + jfloat *attachmentData = + env->GetFloatArrayElements(attachmentPositions, nullptr); auto attachments = TextMeasurement::Attachments{}; if (attachmentsCount > 0) { @@ -283,7 +284,8 @@ TextMeasurement TextLayoutManager::doMeasureMapBuffer( maximumSize.height, attachmentPositions); - jfloat *attachmentData = env->GetFloatArrayElements(attachmentPositions, 0); + jfloat *attachmentData = + env->GetFloatArrayElements(attachmentPositions, nullptr); auto attachments = TextMeasurement::Attachments{}; if (attachmentsCount > 0) {