include/unotools/atom.hxx | 4 ++-- unotools/source/misc/atom.cxx | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-)
New commits: commit 625c93a8daa2d23bfd42908e6fbba428d5967e84 Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Aug 28 09:29:18 2015 +0200 Simplify MultiAtomProvider::getString Change-Id: I3ba6f9c829200349a6404c2a155182b5c5c12cd7 diff --git a/include/unotools/atom.hxx b/include/unotools/atom.hxx index fdc656e..d59f67a 100644 --- a/include/unotools/atom.hxx +++ b/include/unotools/atom.hxx @@ -47,7 +47,7 @@ namespace utl { ~AtomProvider(); int getAtom( const OUString&, bool bCreate = false ); - const OUString& getString( int ) const; + OUString getString( int ) const; }; class UNOTOOLS_DLLPUBLIC MultiAtomProvider @@ -59,7 +59,7 @@ namespace utl { int getAtom( int atomClass, const OUString& rString, bool bCreate = false ); - const OUString& getString( int atomClass, int atom ) const; + OUString getString( int atomClass, int atom ) const; }; } diff --git a/unotools/source/misc/atom.cxx b/unotools/source/misc/atom.cxx index 85ddad4..44ad756 100644 --- a/unotools/source/misc/atom.cxx +++ b/unotools/source/misc/atom.cxx @@ -45,12 +45,11 @@ int AtomProvider::getAtom( const OUString& rString, bool bCreate ) return m_nAtoms-1; } -const OUString& AtomProvider::getString( int nAtom ) const +OUString AtomProvider::getString( int nAtom ) const { - static OUString aEmpty; std::unordered_map<int, OUString>::const_iterator it = m_aStringMap.find( nAtom ); - return it == m_aStringMap.end() ? aEmpty : it->second; + return it == m_aStringMap.end() ? OUString() : it->second; } MultiAtomProvider::MultiAtomProvider() @@ -79,15 +78,14 @@ int MultiAtomProvider::getAtom( int atomClass, const OUString& rString, bool bCr return INVALID_ATOM; } -const OUString& MultiAtomProvider::getString( int atomClass, int atom ) const +OUString MultiAtomProvider::getString( int atomClass, int atom ) const { std::unordered_map<int, AtomProvider*>::const_iterator it = m_aAtomLists.find( atomClass ); if( it != m_aAtomLists.end() ) return it->second->getString( atom ); - static OUString aEmpty; - return aEmpty; + return OUString(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits