From 051260b0e5c8355b9ab60946134b6abb1d8ce656 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 23 Sep 2024 23:35:46 +0000 Subject: [PATCH] Address feedback from aheninger * icu4c/source/i18n/decimfmt.cpp: Explicitly set the pointers to nullptr after deleting them. * icu4c/source/i18n/number_mapper.h: Use `= {}` to initialize pointers to nullptr instead of `= nullptr` to keep project-wide consistency. --- icu4c/source/i18n/decimfmt.cpp | 2 ++ icu4c/source/i18n/number_mapper.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/icu4c/source/i18n/decimfmt.cpp b/icu4c/source/i18n/decimfmt.cpp index 67a0aa11fe5c..7461bb743ccc 100644 --- a/icu4c/source/i18n/decimfmt.cpp +++ b/icu4c/source/i18n/decimfmt.cpp @@ -1647,7 +1647,9 @@ void DecimalFormat::touch(UErrorCode& status) { delete fields->atomicCurrencyParser.exchange(nullptr); #else delete fields->atomicParser; + fields->atomicParser = nullptr; delete fields->atomicCurrencyParser; + fields->atomicCurrencyParser = nullptr; #endif // In order for the getters to work, we need to populate some fields in NumberFormat. diff --git a/icu4c/source/i18n/number_mapper.h b/icu4c/source/i18n/number_mapper.h index def4fec594d6..afac55415b5c 100644 --- a/icu4c/source/i18n/number_mapper.h +++ b/icu4c/source/i18n/number_mapper.h @@ -201,7 +201,7 @@ struct DecimalFormatFields : public UMemory { #if U_HAVE_ATOMICS std::atomic<::icu::numparse::impl::NumberParserImpl*> atomicParser = {}; #else - ::icu::numparse::impl::NumberParserImpl* atomicParser = nullptr; + ::icu::numparse::impl::NumberParserImpl* atomicParser = {}; #endif /** The lazy-computed parser for .parseCurrency() */