]> granicus.if.org Git - icu/commit
ICU-20036 CurrencyPluralInfo class improve handling of OOM errors (#17)
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Mon, 6 Aug 2018 20:22:46 +0000 (13:22 -0700)
committerShane Carr <shane@unicode.org>
Thu, 27 Sep 2018 21:27:37 +0000 (14:27 -0700)
commit02a2c9cce98a3ab9e1403d83ba8c400db905f7d1
tree149dd580b99255b6954e65386334d21622521e6e
parentb24880b19faadd357a6fa4c89dc4edf7d1125d61
ICU-20036 CurrencyPluralInfo class improve handling of OOM errors (#17)

ICU-20036 CurrencyPluralInfo class doesn't always check/handle OOM errors.

Changes include:
- Using LocalPointer instead of raw new/delete, in order to make the code cleaner.
- Using nullptr instead of NULL.
- Inspired by Andy's review feedback PluralRules changes, this change sets fPluralRules and fLocale to nullptr in the assignment operator in order to prevent possible double deletes in the failure case.
- More consistent about not checking for nullptr when calling delete.
- Using LocalUResourceBundlePointer in order to simply the code and not need manual deletes.
- Reduce memory usage by using the same LocalUResourceBundle with .getAlias() instead of allocating new ones.
icu4c/source/i18n/currpinf.cpp
icu4c/source/i18n/unicode/currpinf.h