summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-07-18 14:14:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-19 08:53:46 +0200
commitd67cf46ba862ecdd8bdce451a996e64e2a86cd43 (patch)
tree9552508209d3f47bc582a7fc716c62054bf30e47
parent062bed270b30468437bf2dc6c092be7c724e4e83 (diff)
remove unnecessary rtl::Static
no need to delay-init something we always need, and laying out a std::unordered_map is something we can normally do at link time anyway. Change-Id: Ide791d20394580bca615aa3ad564c154037e0816 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119137 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--cppu/source/uno/EnvStack.cxx18
1 files changed, 7 insertions, 11 deletions
diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx
index 0b037687cdd9..033f9d94ce3f 100644
--- a/cppu/source/uno/EnvStack.cxx
+++ b/cppu/source/uno/EnvStack.cxx
@@ -23,8 +23,6 @@
#include <cppu/EnvDcp.hxx>
#include <cppu/Enterable.hxx>
-#include <rtl/instance.hxx>
-
#include <osl/thread.h>
#include <osl/thread.hxx>
@@ -71,7 +69,7 @@ typedef std::unordered_map<oslThreadIdentifier,
namespace
{
std::mutex s_threadMap_mutex;
- struct s_threadMap : public rtl::Static< ThreadMap, s_threadMap > {};
+ ThreadMap s_threadMap;
}
static void s_setCurrent(uno_Environment * pEnv)
@@ -79,16 +77,15 @@ static void s_setCurrent(uno_Environment * pEnv)
oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
std::lock_guard guard(s_threadMap_mutex);
- ThreadMap &rThreadMap = s_threadMap::get();
if (pEnv)
{
- rThreadMap[threadId] = pEnv;
+ s_threadMap[threadId] = pEnv;
}
else
{
- ThreadMap::iterator iEnv = rThreadMap.find(threadId);
- if( iEnv != rThreadMap.end())
- rThreadMap.erase(iEnv);
+ ThreadMap::iterator iEnv = s_threadMap.find(threadId);
+ if( iEnv != s_threadMap.end())
+ s_threadMap.erase(iEnv);
}
}
@@ -99,9 +96,8 @@ static uno_Environment * s_getCurrent()
oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
std::lock_guard guard(s_threadMap_mutex);
- ThreadMap &rThreadMap = s_threadMap::get();
- ThreadMap::iterator iEnv = rThreadMap.find(threadId);
- if(iEnv != rThreadMap.end())
+ ThreadMap::iterator iEnv = s_threadMap.find(threadId);
+ if(iEnv != s_threadMap.end())
pEnv = iEnv->second;
return pEnv;