summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-05-15 11:59:35 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-05-16 09:04:24 +0200
commitb8aa4d7caf82903b3ba1ff45483756db6835cc60 (patch)
treea9bb802f1c1328d6673ae6be0d9f6551025d4bca /include
parent2fe18c214be06065a2966ffa3d4af5db6606b7ae (diff)
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.lunak@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/svl/sharedstring.hxx18
1 files changed, 18 insertions, 0 deletions
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);