formula/source/core/api/FormulaCompiler.cxx |    8 ++++----
 sc/source/core/tool/compiler.cxx            |   16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 0ab6cb2583b5c835036b366333961a6d386b64ce
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Feb 6 19:49:30 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sat Feb 15 14:32:20 2025 +0100

    Simplify special debug function handling
    
    Having some arrays of C strings far away from the use point; using
    some unobvious arithmetics (with unrelated enum values) to get the
    array elements; using loops just for two elements - all that makes
    simple repeated comparison a better choice.
    
    Change-Id: Icaaa771a2cf529fa2cc2b946d5128ee1deba31e0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181703
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index ca44ac80b04b..1118241350d1 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -43,8 +43,6 @@ namespace formula
 {
     using namespace ::com::sun::star;
 
-    static const char* pInternal[2] = { "TTT", "__DEBUG_VAR" };
-
 namespace {
 
 class FormulaCompilerRecursionGuard
@@ -2610,8 +2608,10 @@ const FormulaToken* 
FormulaCompiler::CreateStringFromToken( OUStringBuffer& rBuf
             }
         }
     }
-    else if( eOp >= ocInternalBegin && eOp <= ocInternalEnd )
-        rBuffer.appendAscii( pInternal[ eOp - ocInternalBegin ] );
+    else if (eOp == ocTTT)
+        rBuffer.append("TTT");
+    else if (eOp == ocDebugVar)
+        rBuffer.append("__DEBUG_VAR");
     else if (eOp == ocIntersect)
     {
         // Nasty, ugly, horrific, terrifying...
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 41663c65f16c..21d059f09d66 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -105,8 +105,6 @@ enum ScanState
 
 }
 
-static const char* pInternal[2] = { "TTT", "__DEBUG_VAR" };
-
 using namespace ::com::sun::star::i18n;
 
 void ScCompiler::fillFromAddInMap( const NonConstOpCodeMapPtr& 
xMap,FormulaGrammar::Grammar _eGrammar  ) const
@@ -3128,13 +3126,15 @@ bool ScCompiler::ParseOpCode( const OUString& rName, 
bool bInArray )
 
 bool ScCompiler::ParseOpCode2( std::u16string_view rName )
 {
-    for (sal_uInt16 i = ocInternalBegin; i <= ocInternalEnd; i++)
+    if (rName == u"TTT")
     {
-        if (o3tl::equalsAscii(rName, pInternal[i - ocInternalBegin]))
-        {
-            maRawToken.SetOpCode(static_cast<OpCode>(i));
-            return true;
-        }
+        maRawToken.SetOpCode(ocTTT);
+        return true;
+    }
+    if (rName == u"__DEBUG_VAR")
+    {
+        maRawToken.SetOpCode(ocDebugVar);
+        return true;
     }
 
     return false;

Reply via email to