cui/source/options/optlingu.cxx |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 3e852b821f74a6ee0ded4d686f0fadb5c2aa588f
Author:     Mike Kaganski <[email protected]>
AuthorDate: Wed Oct 8 11:44:34 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Wed Oct 8 10:02:26 2025 +0200

    Simplify SvxLinguData_Impl::AddRemove using std::move
    
    Change-Id: I622f0fa5945e0adc500d33c1def30f425571bf8b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192057
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 286591d4cb94..043e32c47a04 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -675,21 +675,18 @@ bool SvxLinguData_Impl::AddRemove(
 {
     bool bRet = false;  // modified?
 
-    sal_Int32 nEntries = rConfigured.getLength();
     sal_Int32 nPos = comphelper::findValue(rConfigured, rImplName);
     if (bAdd  &&  nPos < 0)         // add new entry
     {
-        rConfigured.realloc( ++nEntries );
-        OUString *pConfigured = rConfigured.getArray();
-        pConfigured[nEntries - 1] = rImplName;
+        rConfigured.realloc(rConfigured.getLength() + 1);
+        rConfigured.getArray()[rConfigured.getLength() - 1] = rImplName;
         bRet = true;
     }
     else if (!bAdd  &&  nPos >= 0)  // remove existing entry
     {
         OUString *pConfigured = rConfigured.getArray();
-        for (sal_Int32 i = nPos;  i < nEntries - 1;  ++i)
-            pConfigured[i] = pConfigured[i + 1];
-        rConfigured.realloc(--nEntries);
+        std::move(rConfigured.begin() + nPos + 1, rConfigured.end(), 
pConfigured + nPos);
+        rConfigured.realloc(rConfigured.getLength() - 1);
         bRet = true;
     }
 

Reply via email to