]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/servls.cpp
ICU-62135.0.1.tar.gz
[apple/icu.git] / icuSources / common / servls.cpp
index b39e72ed62b973490f5bd537ef90167e4ae318e8..f4579d0eecde60f5e1c8a50b3037d7cdd6f6c057 100644 (file)
@@ -1,6 +1,8 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /**
  *******************************************************************************
- * Copyright (C) 2001-2004, International Business Machines Corporation and    *
+ * Copyright (C) 2001-2014, International Business Machines Corporation and    *
  * others. All Rights Reserved.                                                *
  *******************************************************************************
  *
@@ -15,9 +17,7 @@
 #include "cmemory.h"
 #include "servloc.h"
 #include "ustrfmt.h"
-#include "uhash.h"
 #include "charstr.h"
-#include "ucln_cmn.h"
 #include "uassert.h"
 
 #define UNDERSCORE_CHAR ((UChar)0x005f)
 
 U_NAMESPACE_BEGIN
 
+static UMutex llock = U_MUTEX_INITIALIZER;
 ICULocaleService::ICULocaleService()
   : fallbackLocale(Locale::getDefault())
-  , llock(0)
 {
-  umtx_init(&llock);
 }
 
 ICULocaleService::ICULocaleService(const UnicodeString& dname)
   : ICUService(dname)
   , fallbackLocale(Locale::getDefault())
-  , llock(0)
 {
-  umtx_init(&llock);
 }
 
 ICULocaleService::~ICULocaleService()
 {
-  umtx_destroy(&llock);
 }
 
 UObject*
@@ -167,7 +163,7 @@ private:
     ServiceEnumeration(const ICULocaleService* service, UErrorCode &status)
         : _service(service)
         , _timestamp(service->getTimestamp())
-        , _ids(uhash_deleteUnicodeString, NULL, status)
+        , _ids(uprv_deleteUObject, NULL, status)
         , _pos(0)
     {
         _service->getVisibleIDs(_ids, status);
@@ -176,7 +172,7 @@ private:
     ServiceEnumeration(const ServiceEnumeration &other, UErrorCode &status)
         : _service(other._service)
         , _timestamp(other._timestamp)
-        , _ids(uhash_deleteUnicodeString, NULL, status)
+        , _ids(uprv_deleteUObject, NULL, status)
         , _pos(0)
     {
         if(U_SUCCESS(status)) {
@@ -204,7 +200,7 @@ public:
         return NULL;
     }
 
-    virtual ~ServiceEnumeration() {}
+    virtual ~ServiceEnumeration();
 
     virtual StringEnumeration *clone() const {
         UErrorCode status = U_ZERO_ERROR;
@@ -253,6 +249,8 @@ public:
     virtual UClassID getDynamicClassID(void) const;
 };
 
+ServiceEnumeration::~ServiceEnumeration() {}
+
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ServiceEnumeration)
 
 StringEnumeration*
@@ -267,7 +265,7 @@ ICULocaleService::validateFallbackLocale() const
     const Locale&     loc    = Locale::getDefault();
     ICULocaleService* ncThis = (ICULocaleService*)this;
     {
-        Mutex mutex(&ncThis->llock);
+        Mutex mutex(&llock);
         if (loc != fallbackLocale) {
             ncThis->fallbackLocale = loc;
             LocaleUtility::initNameFromLocale(loc, ncThis->fallbackLocaleName);