Skip to content

Commit

Permalink
ICU-22838 Address feedback from aheninger
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
kateinoigakukun committed Sep 23, 2024
1 parent 9d05a26 commit 008b01c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions icu4c/source/i18n/decimfmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/i18n/number_mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() */
Expand Down

0 comments on commit 008b01c

Please sign in to comment.