include/rtl/ustring.hxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 891d618bfdcf369119807d826e8ec6e3b112d73c
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Sep 19 10:42:24 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Sep 19 13:03:04 2022 +0200

    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.gran...@collabora.co.uk>

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;
     }

Reply via email to