Skip to content

Commit

Permalink
ICU-20042 Improve OOM handling in PluralRules class. (#20)
Browse files Browse the repository at this point in the history
- 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
jefgen authored and sffc committed Sep 27, 2018
1 parent d4fdbb8 commit 8edc6ba
Show file tree
Hide file tree
Showing 3 changed files with 298 additions and 212 deletions.
Loading

0 comments on commit 8edc6ba

Please sign in to comment.