mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-6708 Initialize cache pointers.
X-SVN-Rev: 26454
This commit is contained in:
parent
2cf1de3050
commit
0b176ddfb3
1 changed files with 10 additions and 12 deletions
|
@ -903,7 +903,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
|
|||
UResourceBundle *numberPatterns = ures_getByKey(resource, DecimalFormat::fgNumberPatterns, NULL, &status);
|
||||
NumberingSystem *ns = NULL;
|
||||
UBool deleteSymbols = TRUE;
|
||||
UHashtable * cache;
|
||||
UHashtable * cache = NULL;
|
||||
int32_t hashKey;
|
||||
UBool getCache;
|
||||
|
||||
|
@ -978,7 +978,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
|
|||
uhash_setValueDeleter(cache, deleteNumberingSystem);
|
||||
|
||||
// set final NumberingSystem_cache value
|
||||
UHashtable* h;
|
||||
UHashtable* h = NULL;
|
||||
|
||||
UMTX_CHECK(NULL, (UBool)(h != NumberingSystem_cache), getCache);
|
||||
if (getCache) {
|
||||
|
@ -1002,16 +1002,14 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
|
|||
// Get cached numbering system
|
||||
if (cache != NULL) {
|
||||
hashKey = desiredLocale.hashCode();
|
||||
UMTX_CHECK(NULL, (UBool)(ns == NULL), getCache);
|
||||
if (getCache) {
|
||||
umtx_lock(NULL);
|
||||
ns = (NumberingSystem *)uhash_iget(cache, hashKey);
|
||||
if (ns == NULL) {
|
||||
ns = NumberingSystem::createInstance(desiredLocale,status);
|
||||
uhash_iput(cache, hashKey, (void*)ns, &status);
|
||||
}
|
||||
umtx_unlock(NULL);
|
||||
}
|
||||
|
||||
umtx_lock(NULL);
|
||||
ns = (NumberingSystem *)uhash_iget(cache, hashKey);
|
||||
if (ns == NULL) {
|
||||
ns = NumberingSystem::createInstance(desiredLocale,status);
|
||||
uhash_iput(cache, hashKey, (void*)ns, &status);
|
||||
}
|
||||
umtx_unlock(NULL);
|
||||
}
|
||||
else {
|
||||
ns = NumberingSystem::createInstance(desiredLocale,status);
|
||||
|
|
Loading…
Add table
Reference in a new issue