writerfilter/source/rtftok/rtfdocumentimpl.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 015e7d51b671a9dbf110599855d99a57fda2ae59
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Nov 14 19:50:17 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Nov 15 08:16:07 2023 +0100

    writerfilter: avoid double map lookup in RTFDocumentImpl
    
    It's not much more code and is faster.
    
    Change-Id: I7ed6b80890dce5cb18555e6c66f7b02c49abcde2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159425
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 45f49553b26b..572eab019e59 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -791,8 +791,9 @@ OUString RTFDocumentImpl::getStyleName(int nIndex)
     if (!m_pSuperstream)
     {
         OUString aRet;
-        if (m_aStyleNames.find(nIndex) != m_aStyleNames.end())
-            aRet = m_aStyleNames[nIndex];
+        auto it = m_aStyleNames.find(nIndex);
+        if (it != m_aStyleNames.end())
+            aRet = it->second;
         return aRet;
     }
 
@@ -804,8 +805,9 @@ Id RTFDocumentImpl::getStyleType(int nIndex)
     if (!m_pSuperstream)
     {
         Id nRet = 0;
-        if (m_aStyleTypes.find(nIndex) != m_aStyleTypes.end())
-            nRet = m_aStyleTypes[nIndex];
+        auto it = m_aStyleTypes.find(nIndex);
+        if (it != m_aStyleTypes.end())
+            nRet = it->second;
         return nRet;
     }
 

Reply via email to