Skip to content

Commit

Permalink
Remove uses of new/delete
Browse files Browse the repository at this point in the history
  • Loading branch information
catamorphism committed Oct 17, 2024
1 parent 740ca4f commit 4b7e7bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions icu4c/source/i18n/messageformat2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ FunctionContext MessageFormatter::makeFunctionContext(const FunctionOptions& opt
} else {
UErrorCode localStatus = U_ZERO_ERROR;
int32_t len = localeStr.length();
LocalArray<char> temp(new char[len + 1]);
char* buf = static_cast<char*>(uprv_malloc(len + 1));
LocalArray<char> temp(buf);
localeStr.extract(0, len, temp.getAlias(), len);
Locale l = Locale::forLanguageTag(StringPiece(temp.getAlias(), len), localStatus);
if (U_SUCCESS(localStatus)) {
Expand Down Expand Up @@ -422,7 +423,7 @@ void MessageFormatter::matchSelectorKeys(const UVector& keys,
LocalArray<UnicodeString> adoptedKeys(keysArr);

// Create an array to hold the output
int32_t* prefsArr = new int32_t[keysLen];
int32_t* prefsArr = static_cast<int32_t*>(uprv_malloc(keysLen * sizeof(int32_t)));
if (prefsArr == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
Expand Down

0 comments on commit 4b7e7bf

Please sign in to comment.