[Libreoffice-commits] core.git: cppu/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 19 06:54:21 UTC 2021
cppu/source/uno/EnvStack.cxx | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
New commits:
commit d67cf46ba862ecdd8bdce451a996e64e2a86cd43
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Jul 18 14:14:53 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 19 08:53:46 2021 +0200
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 at collabora.co.uk>
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;
More information about the Libreoffice-commits
mailing list