sc/source/core/tool/interpr1.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 1bbcac7d172f9b0b97d54b07160ac6b5e736e651
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Mar 10 11:05:02 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Mar 10 11:02:18 2022 +0100

    Use readonly-aliasing icu::UnicodeString ctor to avoid extra copy
    
    See also commit 4ac48ae4b02b8e0e3ae7e4833893f9ad40d4d14d
      Date   Fri Feb 28 14:20:24 2020 +0300
        Use icu::UnicodeString's readonly-aliasing char16_t* constructor
    
    Change-Id: I40243543ae9b4bf97f015f657538e4b1a0eafae6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131299
    Tested-by: Mike Kaganski <mike.kagan...@collabora.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f57dd83c282b..db8b282500ba 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -9448,8 +9448,8 @@ void ScInterpreter::ScRegex()
     // If bGlobalReplacement==true and bReplacement==false then
     // bGlobalReplacement is silently ignored.
 
-    OUString aExpression = GetString().getString();
-    OUString aText = GetString().getString();
+    const OUString aExpression = GetString().getString();
+    const OUString aText = GetString().getString();
 
     if (nGlobalError != FormulaError::NONE)
     {
@@ -9465,7 +9465,7 @@ void ScInterpreter::ScRegex()
     }
 
     const icu::UnicodeString aIcuExpression(
-            reinterpret_cast<const UChar*>(aExpression.getStr()), 
aExpression.getLength());
+        false, reinterpret_cast<const UChar*>(aExpression.getStr()), 
aExpression.getLength());
     UErrorCode status = U_ZERO_ERROR;
     icu::RegexMatcher aRegexMatcher( aIcuExpression, 0, status);
     if (U_FAILURE(status))
@@ -9478,7 +9478,7 @@ void ScInterpreter::ScRegex()
     // 
https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classicu_1_1RegexMatcher.html#a6ebcfcab4fe6a38678c0291643a03a00
     aRegexMatcher.setTimeLimit( 23*1000, status);
 
-    const icu::UnicodeString aIcuText( reinterpret_cast<const 
UChar*>(aText.getStr()), aText.getLength());
+    const icu::UnicodeString aIcuText(false, reinterpret_cast<const 
UChar*>(aText.getStr()), aText.getLength());
     aRegexMatcher.reset( aIcuText);
 
     if (!bReplacement)
@@ -9518,7 +9518,7 @@ void ScInterpreter::ScRegex()
     }
 
     const icu::UnicodeString aIcuReplacement(
-            reinterpret_cast<const UChar*>(aReplacement.getStr()), 
aReplacement.getLength());
+        false, reinterpret_cast<const UChar*>(aReplacement.getStr()), 
aReplacement.getLength());
     icu::UnicodeString aReplaced;
     if (bGlobalReplacement)
         // Replace all occurrences of match with replacement.

Reply via email to