diff options
Diffstat (limited to 'deps/icu-small/source/i18n/tzfmt.cpp')
-rw-r--r-- | deps/icu-small/source/i18n/tzfmt.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/deps/icu-small/source/i18n/tzfmt.cpp b/deps/icu-small/source/i18n/tzfmt.cpp index df4dec1feb..c948c5f5e7 100644 --- a/deps/icu-small/source/i18n/tzfmt.cpp +++ b/deps/icu-small/source/i18n/tzfmt.cpp @@ -147,7 +147,10 @@ static icu::UInitOnce gZoneIdTrieInitOnce = U_INITONCE_INITIALIZER; static TextTrieMap *gShortZoneIdTrie = NULL; static icu::UInitOnce gShortZoneIdTrieInitOnce = U_INITONCE_INITIALIZER; -static UMutex gLock = U_MUTEX_INITIALIZER; +static UMutex *gLock() { + static UMutex m = U_MUTEX_INITIALIZER; + return &m; +} U_CDECL_BEGIN /** @@ -267,7 +270,7 @@ GMTOffsetField::isValid(FieldType type, int32_t width) { case SECOND: return (width == 2); default: - U_ASSERT(FALSE); + UPRV_UNREACHABLE; } return (width > 0); } @@ -589,8 +592,7 @@ TimeZoneFormat::setGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, co required = FIELDS_HMS; break; default: - U_ASSERT(FALSE); - break; + UPRV_UNREACHABLE; } UVector* patternItems = parseOffsetPattern(pattern, required, status); @@ -1028,7 +1030,7 @@ TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, Par break; default: - U_ASSERT(FALSE); + UPRV_UNREACHABLE; } int32_t len = 0; @@ -1383,12 +1385,12 @@ TimeZoneFormat::getTimeZoneGenericNames(UErrorCode& status) const { return NULL; } - umtx_lock(&gLock); + umtx_lock(gLock()); if (fTimeZoneGenericNames == NULL) { TimeZoneFormat *nonConstThis = const_cast<TimeZoneFormat *>(this); nonConstThis->fTimeZoneGenericNames = TimeZoneGenericNames::createInstance(fLocale, status); } - umtx_unlock(&gLock); + umtx_unlock(gLock()); return fTimeZoneGenericNames; } @@ -1399,7 +1401,7 @@ TimeZoneFormat::getTZDBTimeZoneNames(UErrorCode& status) const { return NULL; } - umtx_lock(&gLock); + umtx_lock(gLock()); if (fTZDBTimeZoneNames == NULL) { TZDBTimeZoneNames *tzdbNames = new TZDBTimeZoneNames(fLocale); if (tzdbNames == NULL) { @@ -1409,7 +1411,7 @@ TimeZoneFormat::getTZDBTimeZoneNames(UErrorCode& status) const { nonConstThis->fTZDBTimeZoneNames = tzdbNames; } } - umtx_unlock(&gLock); + umtx_unlock(gLock()); return fTZDBTimeZoneNames; } |