diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-29 11:22:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-29 14:35:44 +0200 |
commit | 6c7d6924511f3006f64fb9d3eadd289778098571 (patch) | |
tree | 297a3f410e9b3281a1799b18c98441a837b8a560 /tools | |
parent | 2e894d5053dccadc41f4c449e8fbdd3ada0c5bdc (diff) |
rtl::Static -> static local
in a handful cases, like a map or a vector, we don't need init on demand
at all, the default constructor can be laid out at compile time
Change-Id: I2d404584b5aa23db7b1f779e160e04e72dd2aa74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119656
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/stream/strmunx.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index e034f53ac33b..6743993f112e 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -40,7 +40,7 @@ namespace { struct LockMutex : public rtl::Static< osl::Mutex, LockMutex > {}; -struct Locks : public rtl::Static< std::map<SvFileStream const *, osl::DirectoryItem>, Locks > {}; +std::map<SvFileStream const *, osl::DirectoryItem> gLocks; bool lockFile( const SvFileStream* pStream ) { @@ -61,8 +61,7 @@ bool lockFile( const SvFileStream* pStream ) return true; osl::MutexGuard aGuard( LockMutex::get() ); - auto &rLocks = Locks::get(); - for( const auto& [rLockStream, rLockItem] : rLocks ) + for( const auto& [rLockStream, rLockItem] : gLocks ) { if( aItem.isIdenticalTo( rLockItem ) ) { @@ -78,15 +77,14 @@ bool lockFile( const SvFileStream* pStream ) } } } - rLocks[pStream] = aItem; + gLocks[pStream] = aItem; return true; } void unlockFile( SvFileStream const * pStream ) { osl::MutexGuard aGuard( LockMutex::get() ); - auto &rLocks = Locks::get(); - rLocks.erase(pStream); + gLocks.erase(pStream); } } |