include/svl/sharedstring.hxx     |   18 ++++++++++++++++++
 svl/source/misc/sharedstring.cxx |   16 ----------------
 2 files changed, 18 insertions(+), 16 deletions(-)

New commits:
commit b8aa4d7caf82903b3ba1ff45483756db6835cc60
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Sun May 15 11:59:35 2022 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Mon May 16 09:04:24 2022 +0200

    make SharedString move operator= inline (tdf#126109)
    
    Calc uses SharedString in mdds::multi_type_vector, which may move
    contents of its blocks on some operations, and making this inline
    makes such operations faster.
    
    Change-Id: I67d14639cf253c56b8cca5b2837bb06bc9afd7d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134339
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/include/svl/sharedstring.hxx b/include/svl/sharedstring.hxx
index 050bd8dd9e55..5b5c35b95a92 100644
--- a/include/svl/sharedstring.hxx
+++ b/include/svl/sharedstring.hxx
@@ -88,6 +88,24 @@ inline SharedString::~SharedString()
         rtl_uString_release(mpDataIgnoreCase);
 }
 
+inline SharedString& SharedString::operator=(SharedString&& r) noexcept
+{
+    // Having this inline helps Calc's mdds::multi_type_vector to do some 
operations
+    // much faster.
+    if (mpData)
+        rtl_uString_release(mpData);
+    if (mpDataIgnoreCase)
+        rtl_uString_release(mpDataIgnoreCase);
+
+    mpData = r.mpData;
+    mpDataIgnoreCase = r.mpDataIgnoreCase;
+
+    r.mpData = nullptr;
+    r.mpDataIgnoreCase = nullptr;
+
+    return *this;
+}
+
 inline bool SharedString::operator!= ( const SharedString& r ) const
 {
     return !operator== (r);
diff --git a/svl/source/misc/sharedstring.cxx b/svl/source/misc/sharedstring.cxx
index e1f2d4feed0f..1bb05c6ace50 100644
--- a/svl/source/misc/sharedstring.cxx
+++ b/svl/source/misc/sharedstring.cxx
@@ -43,22 +43,6 @@ SharedString& SharedString::operator= ( const SharedString& 
r )
     return *this;
 }
 
-SharedString& SharedString::operator=(SharedString&& r) noexcept
-{
-    if (mpData)
-        rtl_uString_release(mpData);
-    if (mpDataIgnoreCase)
-        rtl_uString_release(mpDataIgnoreCase);
-
-    mpData = r.mpData;
-    mpDataIgnoreCase = r.mpDataIgnoreCase;
-
-    r.mpData = nullptr;
-    r.mpDataIgnoreCase = nullptr;
-
-    return *this;
-}
-
 bool SharedString::operator== ( const SharedString& r ) const
 {
     // Compare only the original (not case-folded) string.

Reply via email to