Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ICU-20042 Improve OOM handling in PluralRules class. (#20)
- PluralRules class doesn't handle out-of-memory (OOM) errors in some code paths. - The clone and assignment operator (operator=) methods of construction don't take an error code parameter, meaning that if an OOM error occurs during the constructor, it will not reported back to the caller, and the caller has no way to know that the object is in a half-constructed state. - Using an internal status variable for these above cases. - Changes to the various PluralRules helper classes to check for OOM as well. - Using nullptr instead NULL. - Using LocalPointer instead of raw new/delete in some cases. - Need to set mRules to nullptr, otherwise we can end up with double deletes in the failure case. (Thanks to Andy for the review). - Using default member initializers for class members to avoid dangling pointers. Also allows for using default constructors too.
- Loading branch information