[Libreoffice-commits] core.git: svl/source svtools/source unotools/source

Michael Stahl mstahl at redhat.com
Thu Jun 16 13:29:47 UTC 2016


 svl/source/config/cjkoptions.cxx                   |   13 ++++++++-----
 svl/source/config/ctloptions.cxx                   |   14 +++++++++-----
 svtools/source/config/menuoptions.cxx              |   10 +++++++---
 svtools/source/config/miscopt.cxx                  |   10 +++++++---
 unotools/source/config/cmdoptions.cxx              |   10 +++++++---
 unotools/source/config/defaultoptions.cxx          |   10 +++++++---
 unotools/source/config/extendedsecurityoptions.cxx |   10 +++++++---
 unotools/source/config/fontoptions.cxx             |   10 +++++++---
 unotools/source/config/historyoptions.cxx          |   10 +++++++---
 unotools/source/config/localisationoptions.cxx     |   10 +++++++---
 unotools/source/config/misccfg.cxx                 |    6 +++---
 unotools/source/config/pathoptions.cxx             |    6 +++---
 unotools/source/config/printwarningoptions.cxx     |    6 +++---
 unotools/source/config/securityoptions.cxx         |   10 +++++++---
 unotools/source/misc/syslocale.cxx                 |   10 +++++++---
 15 files changed, 96 insertions(+), 49 deletions(-)

New commits:
commit ed8a2341b9631ad312ff40d23331c66d537aad20
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jun 16 15:24:29 2016 +0200

    properly prefix various global variables and hide them
    
    Change-Id: I6b97e6a4c6ac4c0e26bcbb2b132b333920c16f19

diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx
index 3eba25b..e0b1b9e 100644
--- a/svl/source/config/cjkoptions.cxx
+++ b/svl/source/config/cjkoptions.cxx
@@ -376,20 +376,23 @@ bool SvtCJKOptions_Impl::IsReadOnly(SvtCJKOptions::EOption eOption) const
     return bReadOnly;
 }
 
-// global
-std::weak_ptr<SvtCJKOptions_Impl>  pCJKOptions;
+namespace {
 
-namespace { struct theCJKOptionsMutex : public rtl::Static< ::osl::Mutex , theCJKOptionsMutex >{}; }
+    // global
+    std::weak_ptr<SvtCJKOptions_Impl> g_pCJKOptions;
+
+    struct theCJKOptionsMutex : public rtl::Static< ::osl::Mutex , theCJKOptionsMutex >{};
+}
 
 SvtCJKOptions::SvtCJKOptions(bool bDontLoad)
 {
     // Global access, must be guarded (multithreading)
     ::osl::MutexGuard aGuard( theCJKOptionsMutex::get() );
-    pImpl = pCJKOptions.lock();
+    pImpl = g_pCJKOptions.lock();
     if ( !pImpl )
     {
         pImpl = std::make_shared<SvtCJKOptions_Impl>();
-        pCJKOptions = pImpl;
+        g_pCJKOptions = pImpl;
         ItemHolder2::holdConfigItem(E_CJKOPTIONS);
     }
 
diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx
index ef2a610..245c385 100644
--- a/svl/source/config/ctloptions.cxx
+++ b/svl/source/config/ctloptions.cxx
@@ -372,21 +372,25 @@ void SvtCTLOptions_Impl::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumer
         NotifyListeners(0);
     }
 }
-// global
-std::weak_ptr<SvtCTLOptions_Impl>  pCTLOptions;
 
-namespace { struct CTLMutex : public rtl::Static< osl::Mutex, CTLMutex > {}; }
+namespace {
+
+    // global
+    std::weak_ptr<SvtCTLOptions_Impl> g_pCTLOptions;
+
+    struct CTLMutex : public rtl::Static< osl::Mutex, CTLMutex > {};
+}
 
 SvtCTLOptions::SvtCTLOptions( bool bDontLoad )
 {
     // Global access, must be guarded (multithreading)
     ::osl::MutexGuard aGuard( CTLMutex::get() );
 
-    m_pImpl = pCTLOptions.lock();
+    m_pImpl = g_pCTLOptions.lock();
     if ( !m_pImpl )
     {
         m_pImpl = std::make_shared<SvtCTLOptions_Impl>();
-        pCTLOptions = m_pImpl;
+        g_pCTLOptions = m_pImpl;
         ItemHolder2::holdConfigItem(E_CTLOPTIONS);
     }
 
diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx
index be735a6..c0fcaef 100644
--- a/svtools/source/config/menuoptions.cxx
+++ b/svtools/source/config/menuoptions.cxx
@@ -315,18 +315,22 @@ Sequence< OUString > SvtMenuOptions_Impl::impl_GetPropertyNames()
     return seqPropertyNames;
 }
 
-std::weak_ptr<SvtMenuOptions_Impl> m_pMenuOptions;
+namespace {
+
+std::weak_ptr<SvtMenuOptions_Impl> g_pMenuOptions;
+
+}
 
 SvtMenuOptions::SvtMenuOptions()
 {
     // Global access, must be guarded (multithreading!).
     MutexGuard aGuard( GetOwnStaticMutex() );
 
-    m_pImpl = m_pMenuOptions.lock();
+    m_pImpl = g_pMenuOptions.lock();
     if( !m_pImpl )
     {
         m_pImpl = std::make_shared<SvtMenuOptions_Impl>();
-        m_pMenuOptions = m_pImpl;
+        g_pMenuOptions = m_pImpl;
         svtools::ItemHolder2::holdConfigItem(E_MENUOPTIONS);
     }
 }
diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx
index e0ecfd8..2d30403 100644
--- a/svtools/source/config/miscopt.cxx
+++ b/svtools/source/config/miscopt.cxx
@@ -643,18 +643,22 @@ Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames()
     return seqPropertyNames;
 }
 
-std::weak_ptr<SvtMiscOptions_Impl> m_pMiscOptions;
+namespace {
+
+std::weak_ptr<SvtMiscOptions_Impl> g_pMiscOptions;
+
+}
 
 SvtMiscOptions::SvtMiscOptions()
 {
     // Global access, must be guarded (multithreading!).
     MutexGuard aGuard( GetInitMutex() );
 
-    m_pImpl = m_pMiscOptions.lock();
+    m_pImpl = g_pMiscOptions.lock();
     if( !m_pImpl )
     {
         m_pImpl = std::make_shared<SvtMiscOptions_Impl>();
-        m_pMiscOptions = m_pImpl;
+        g_pMiscOptions = m_pImpl;
         svtools::ItemHolder2::holdConfigItem(E_MISCOPTIONS);
     }
 }
diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx
index 0fb89be..c79ba2a 100644
--- a/unotools/source/config/cmdoptions.cxx
+++ b/unotools/source/config/cmdoptions.cxx
@@ -286,18 +286,22 @@ Sequence< OUString > SvtCommandOptions_Impl::impl_GetPropertyNames()
     return lDisabledItems;
 }
 
-std::weak_ptr<SvtCommandOptions_Impl> m_pCommandOptions;
+namespace {
+
+std::weak_ptr<SvtCommandOptions_Impl> g_pCommandOptions;
+
+}
 
 SvtCommandOptions::SvtCommandOptions()
 {
     // Global access, must be guarded (multithreading!).
     MutexGuard aGuard( GetOwnStaticMutex() );
 
-    m_pImpl = m_pCommandOptions.lock();
+    m_pImpl = g_pCommandOptions.lock();
     if( !m_pImpl )
     {
         m_pImpl = std::make_shared<SvtCommandOptions_Impl>();
-        m_pCommandOptions = m_pImpl;
+        g_pCommandOptions = m_pImpl;
         ItemHolder1::holdConfigItem(E_CMDOPTIONS);
     }
 }
diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx
index 82c66b8..0bcba50 100644
--- a/unotools/source/config/defaultoptions.cxx
+++ b/unotools/source/config/defaultoptions.cxx
@@ -104,7 +104,11 @@ private:
 
 // global ----------------------------------------------------------------
 
-std::weak_ptr<SvtDefaultOptions_Impl>  pOptions;
+namespace {
+
+std::weak_ptr<SvtDefaultOptions_Impl> g_pOptions;
+
+}
 
 typedef OUString SvtDefaultOptions_Impl:: *PathStrPtr;
 
@@ -326,11 +330,11 @@ SvtDefaultOptions::SvtDefaultOptions()
 {
     // Global access, must be guarded (multithreading)
     ::osl::MutexGuard aGuard( lclMutex::get() );
-    pImpl = pOptions.lock();
+    pImpl = g_pOptions.lock();
     if ( !pImpl )
     {
         pImpl = std::make_shared<SvtDefaultOptions_Impl>();
-        pOptions = pImpl;
+        g_pOptions = pImpl;
         ItemHolder1::holdConfigItem(E_DEFAULTOPTIONS);
     }
 }
diff --git a/unotools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx
index 1fb58bd..1037d58 100644
--- a/unotools/source/config/extendedsecurityoptions.cxx
+++ b/unotools/source/config/extendedsecurityoptions.cxx
@@ -239,18 +239,22 @@ Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetPropertyNames()
     return seqPropertyNames;
 }
 
-std::weak_ptr<SvtExtendedSecurityOptions_Impl> m_pExtendedSecurityOptions;
+namespace {
+
+std::weak_ptr<SvtExtendedSecurityOptions_Impl> g_pExtendedSecurityOptions;
+
+}
 
 SvtExtendedSecurityOptions::SvtExtendedSecurityOptions()
 {
     // Global access, must be guarded (multithreading!).
     MutexGuard aGuard( GetInitMutex() );
 
-    m_pImpl = m_pExtendedSecurityOptions.lock();
+    m_pImpl = g_pExtendedSecurityOptions.lock();
     if( !m_pImpl )
     {
         m_pImpl = std::make_shared<SvtExtendedSecurityOptions_Impl>();
-        m_pExtendedSecurityOptions = m_pImpl;
+        g_pExtendedSecurityOptions = m_pImpl;
         ItemHolder1::holdConfigItem(E_EXTENDEDSECURITYOPTIONS);
     }
 }
diff --git a/unotools/source/config/fontoptions.cxx b/unotools/source/config/fontoptions.cxx
index 4aa7732..61b9c54 100644
--- a/unotools/source/config/fontoptions.cxx
+++ b/unotools/source/config/fontoptions.cxx
@@ -243,18 +243,22 @@ Sequence< OUString > SvtFontOptions_Impl::impl_GetPropertyNames()
     return seqPropertyNames;
 }
 
-std::weak_ptr<SvtFontOptions_Impl> m_pFontOptions;
+namespace {
+
+std::weak_ptr<SvtFontOptions_Impl> g_pFontOptions;
+
+}
 
 SvtFontOptions::SvtFontOptions()
 {
     // Global access, must be guarded (multithreading!).
     MutexGuard aGuard( impl_GetOwnStaticMutex() );
 
-    m_pImpl = m_pFontOptions.lock();
+    m_pImpl = g_pFontOptions.lock();
     if( !m_pImpl )
     {
         m_pImpl = std::make_shared<SvtFontOptions_Impl>();
-        m_pFontOptions = m_pImpl;
+        g_pFontOptions = m_pImpl;
         ItemHolder1::holdConfigItem(E_FONTOPTIONS);
     }
 }
diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx
index 1cd2587..6dd8441 100644
--- a/unotools/source/config/historyoptions.cxx
+++ b/unotools/source/config/historyoptions.cxx
@@ -523,17 +523,21 @@ void SvtHistoryOptions_Impl::DeleteItem(EHistoryType eHistory, const OUString& s
     }
 }
 
-std::weak_ptr<SvtHistoryOptions_Impl> m_pHistoryOptions;
+namespace {
+
+std::weak_ptr<SvtHistoryOptions_Impl> g_pHistoryOptions;
+
+}
 
 SvtHistoryOptions::SvtHistoryOptions()
 {
     MutexGuard aGuard(theHistoryOptionsMutex::get());
 
-    m_pImpl = m_pHistoryOptions.lock();
+    m_pImpl = g_pHistoryOptions.lock();
     if( !m_pImpl )
     {
         m_pImpl = std::make_shared<SvtHistoryOptions_Impl>();
-        m_pHistoryOptions = m_pImpl;
+        g_pHistoryOptions = m_pImpl;
         ItemHolder1::holdConfigItem(E_HISTORYOPTIONS);
     }
 }
diff --git a/unotools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx
index 87ceaed..6716a03 100644
--- a/unotools/source/config/localisationoptions.cxx
+++ b/unotools/source/config/localisationoptions.cxx
@@ -218,18 +218,22 @@ Sequence< OUString > SvtLocalisationOptions_Impl::GetPropertyNames()
     return seqPropertyNames;
 }
 
-std::weak_ptr<SvtLocalisationOptions_Impl> m_pLocalisationOptions;
+namespace {
+
+std::weak_ptr<SvtLocalisationOptions_Impl> g_pLocalisationOptions;
+
+}
 
 SvtLocalisationOptions::SvtLocalisationOptions()
 {
     // Global access, must be guarded (multithreading!).
     MutexGuard aGuard( GetOwnStaticMutex() );
 
-    m_pImpl = m_pLocalisationOptions.lock();
+    m_pImpl = g_pLocalisationOptions.lock();
     if( !m_pImpl )
     {
         m_pImpl = std::make_shared<SvtLocalisationOptions_Impl>();
-        m_pLocalisationOptions = m_pImpl;
+        g_pLocalisationOptions = m_pImpl;
         ItemHolder1::holdConfigItem(E_LOCALISATIONOPTIONS);
     }
 }
diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx
index 094945b..d50542c 100644
--- a/unotools/source/config/misccfg.cxx
+++ b/unotools/source/config/misccfg.cxx
@@ -33,7 +33,7 @@ namespace utl
 {
 class SfxMiscCfg;
 
-std::weak_ptr<SfxMiscCfg> m_pOptions;
+std::weak_ptr<SfxMiscCfg> g_pOptions;
 
 class SfxMiscCfg : public utl::ConfigItem
 {
@@ -186,11 +186,11 @@ MiscCfg::MiscCfg( )
 {
     // Global access, must be guarded (multithreading)
     ::osl::MutexGuard aGuard( LocalSingleton::get() );
-    m_pImpl = m_pOptions.lock();
+    m_pImpl = g_pOptions.lock();
     if ( !m_pImpl )
     {
         m_pImpl = std::make_shared<SfxMiscCfg>();
-        m_pOptions = m_pImpl;
+        g_pOptions = m_pImpl;
         ItemHolder1::holdConfigItem(E_MISCCFG);
     }
 
diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx
index 28632ca..d5963e7 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -162,7 +162,7 @@ class SvtPathOptions_Impl
 
 // global ----------------------------------------------------------------
 
-static std::weak_ptr<SvtPathOptions_Impl> pOptions;
+static std::weak_ptr<SvtPathOptions_Impl> g_pOptions;
 
 // functions -------------------------------------------------------------
 struct PropertyStruct
@@ -446,11 +446,11 @@ SvtPathOptions::SvtPathOptions()
 {
     // Global access, must be guarded (multithreading)
     ::osl::MutexGuard aGuard( lclMutex::get() );
-    pImpl = pOptions.lock();
+    pImpl = g_pOptions.lock();
     if ( !pImpl )
     {
         pImpl = std::make_shared<SvtPathOptions_Impl>();
-        pOptions = pImpl;
+        g_pOptions = pImpl;
         ItemHolder1::holdConfigItem(E_PATHOPTIONS);
     }
 }
diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx
index 42b1059..e325f63 100644
--- a/unotools/source/config/printwarningoptions.cxx
+++ b/unotools/source/config/printwarningoptions.cxx
@@ -221,18 +221,18 @@ Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames()
     return seqPropertyNames;
 }
 
-std::weak_ptr<SvtPrintWarningOptions_Impl> m_pPrintWarningOptions;
+std::weak_ptr<SvtPrintWarningOptions_Impl> g_pPrintWarningOptions;
 
 SvtPrintWarningOptions::SvtPrintWarningOptions()
 {
     // Global access, must be guarded (multithreading!).
     MutexGuard aGuard( GetOwnStaticMutex() );
 
-    m_pImpl = m_pPrintWarningOptions.lock();
+    m_pImpl = g_pPrintWarningOptions.lock();
     if( !m_pImpl )
     {
         m_pImpl = std::make_shared<SvtPrintWarningOptions_Impl>();
-        m_pPrintWarningOptions = m_pImpl;
+        g_pPrintWarningOptions = m_pImpl;
         ItemHolder1::holdConfigItem(E_PRINTWARNINGOPTIONS);
     }
 }
diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx
index d89ba66..af8be60 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -930,18 +930,22 @@ Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames()
     return seqPropertyNames;
 }
 
-std::weak_ptr<SvtSecurityOptions_Impl> m_pSecurityOptions;
+namespace {
+
+std::weak_ptr<SvtSecurityOptions_Impl> g_pSecurityOptions;
+
+}
 
 SvtSecurityOptions::SvtSecurityOptions()
 {
     // Global access, must be guarded (multithreading!).
     MutexGuard aGuard( GetInitMutex() );
 
-    m_pImpl = m_pSecurityOptions.lock();
+    m_pImpl = g_pSecurityOptions.lock();
     if( !m_pImpl )
     {
         m_pImpl = std::make_shared<SvtSecurityOptions_Impl>();
-        m_pSecurityOptions = m_pImpl;
+        g_pSecurityOptions = m_pImpl;
 
         ItemHolder1::holdConfigItem(E_SECURITYOPTIONS);
     }
diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx
index b0cef62..b212100 100644
--- a/unotools/source/misc/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -34,7 +34,11 @@
 using namespace osl;
 using namespace com::sun::star;
 
-std::weak_ptr<SvtSysLocale_Impl>  pSysLocale;
+namespace {
+
+std::weak_ptr<SvtSysLocale_Impl> g_pSysLocale;
+
+}
 
 class SvtSysLocale_Impl : public utl::ConfigurationListener
 {
@@ -113,11 +117,11 @@ void SvtSysLocale_Impl::setDateAcceptancePatternsConfig()
 SvtSysLocale::SvtSysLocale()
 {
     MutexGuard aGuard( GetMutex() );
-    pImpl = pSysLocale.lock();
+    pImpl = g_pSysLocale.lock();
     if ( !pImpl )
     {
         pImpl = std::make_shared<SvtSysLocale_Impl>();
-        pSysLocale = pImpl;
+        g_pSysLocale = pImpl;
     }
 }
 


More information about the Libreoffice-commits mailing list