summaryrefslogtreecommitdiff
path: root/include/rtl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-09-19 10:42:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-09-19 13:03:04 +0200
commit891d618bfdcf369119807d826e8ec6e3b112d73c (patch)
tree2d9a6000c9f4ee46742e1665fff07e55ecf7db9b /include/rtl
parentd5e1a11b028fb9c03ff80f986f33927d6667627d (diff)
make OUString::operator=(OUString&&) a little faster
one function call instead of two, and this function is pretty hot Change-Id: Ibb09ad9b930f337706fa392a1644077c82dbc61e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140140 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/rtl')
-rw-r--r--include/rtl/ustring.hxx5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 8e29742b588d..c9067905a0a0 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -576,9 +576,8 @@ public:
*/
OUString & operator=( OUString && str ) noexcept
{
- rtl_uString_release( pData );
- pData = str.pData;
- str.pData = nullptr;
+ std::swap(pData, str.pData);
+ // rtl_uString_new will release any existing data before assigning empty
rtl_uString_new( &str.pData );
return *this;
}