basic/source/comp/io.cxx            |   37 +++++++++++++++---------------------
 sw/source/uibase/shells/textsh1.cxx |   17 ++--------------
 2 files changed, 19 insertions(+), 35 deletions(-)

New commits:
commit b800b10737b5df377d8e06e920f10f955b8ddcad
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Nov 2 21:09:53 2024 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Nov 2 18:27:27 2024 +0100

    Simplify a bit
    
    Change-Id: Ia297a94b9fe06074e06ca573173a9e9c41834240
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175954
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 78ae5f81ebcd..1cb57d0a59cf 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -523,21 +523,10 @@ void DeleteSections(SfxRequest& rReq, SwWrtShell& rWrtSh)
         });
 
     SwDoc* pDoc = rWrtSh.GetDoc();
-    SwSectionFormats& rFormats = pDoc->GetSections();
     std::vector<SwSectionFormat*> aRemovals;
-    for (SwSectionFormat* pFormat : rFormats)
-    {
-
-        if (!aSectionNamePrefix.isEmpty())
-        {
-            if (!pFormat->GetName().startsWith(aSectionNamePrefix))
-            {
-                continue;
-            }
-        }
-
-        aRemovals.push_back(pFormat);
-    }
+    for (SwSectionFormat* pFormat : pDoc->GetSections())
+        if (aSectionNamePrefix.isEmpty() || 
pFormat->GetName().startsWith(aSectionNamePrefix))
+            aRemovals.push_back(pFormat);
 
     for (const auto& pFormat : aRemovals)
     {
commit 4f1c88bb57ba0ceadb847e4ce6a00528ad9e7ada
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sat Nov 2 20:40:24 2024 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Nov 2 18:27:22 2024 +0100

    Simplify a bit
    
    Change-Id: I2e4635c660a57abefa57b046e3f0da411939cf1b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175953
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx
index 672a04d83f7c..3973dca21de4 100644
--- a/basic/source/comp/io.cxx
+++ b/basic/source/comp/io.cxx
@@ -80,9 +80,7 @@ void SbiParser::Write()
 
     while( !bAbort )
     {
-        std::optional<SbiExpression> pExpr(std::in_place, this);
-        pExpr->Gen();
-        pExpr.reset();
+        SbiExpression(this).Gen();
         aGen.Gen( SbiOpcode::BWRITE_ );
         if( Peek() == COMMA )
         {
@@ -128,14 +126,15 @@ void SbiParser::Line()
 void SbiParser::LineInput()
 {
     Channel( true );
-    std::optional<SbiExpression> pExpr( std::in_place, this, SbOPERAND );
-    if( !pExpr->IsVariable() )
-        Error( ERRCODE_BASIC_VAR_EXPECTED );
-    if( pExpr->GetType() != SbxVARIANT && pExpr->GetType() != SbxSTRING )
-        Error( ERRCODE_BASIC_CONVERSION );
-    pExpr->Gen();
-    aGen.Gen( SbiOpcode::LINPUT_ );
-    pExpr.reset();
+    {
+        SbiExpression aExpr(this, SbOPERAND);
+        if (!aExpr.IsVariable())
+            Error(ERRCODE_BASIC_VAR_EXPECTED);
+        if (aExpr.GetType() != SbxVARIANT && aExpr.GetType() != SbxSTRING)
+            Error(ERRCODE_BASIC_CONVERSION);
+        aExpr.Gen();
+        aGen.Gen(SbiOpcode::LINPUT_);
+    }
     aGen.Gen( SbiOpcode::CHAN0_ );     // ResetChannel() not in StepLINPUT() 
anymore
 }
 
@@ -145,21 +144,17 @@ void SbiParser::Input()
 {
     aGen.Gen( SbiOpcode::RESTART_ );
     Channel( true );
-    std::optional<SbiExpression> pExpr( std::in_place, this, SbOPERAND );
     while( !bAbort )
     {
-        if( !pExpr->IsVariable() )
+        SbiExpression aExpr(this, SbOPERAND);
+        if (!aExpr.IsVariable())
             Error( ERRCODE_BASIC_VAR_EXPECTED );
-        pExpr->Gen();
+        aExpr.Gen();
         aGen.Gen( SbiOpcode::INPUT_ );
-        if( Peek() == COMMA )
-        {
-            Next();
-            pExpr.emplace( this, SbOPERAND );
-        }
-        else break;
+        if (Peek() != COMMA)
+            break;
+        Next();
     }
-    pExpr.reset();
     aGen.Gen( SbiOpcode::CHAN0_ );
 }
 

Reply via email to