From ab95f940485e5725bb91c37e4a1c32910e500161 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 18 Dec 2017 09:34:53 -0800 Subject: [PATCH] [muparser] Remove m_nIfElseCounter instance variable No idea why this isn't just a local. --- muparser-2.2.5/include/muParserBase.h | 3 --- muparser-2.2.5/src/muParserBase.cpp | 11 +++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/muparser-2.2.5/include/muParserBase.h b/muparser-2.2.5/include/muParserBase.h index c8eae0d79..cbc3d0546 100644 --- a/muparser-2.2.5/include/muParserBase.h +++ b/muparser-2.2.5/include/muParserBase.h @@ -270,9 +270,6 @@ class ParserBase { string_type m_sOprtChars; ///< Charset for postfix/ binary operator tokens string_type m_sInfixOprtChars; ///< Charset for infix operator tokens - mutable int - m_nIfElseCounter; ///< Internal counter for keeping track of nested if-then-else clauses - // items merely used for caching state information mutable valbuf_type m_vStackBuffer; ///< This is merely a buffer used for the stack in the cmd parsing routine diff --git a/muparser-2.2.5/src/muParserBase.cpp b/muparser-2.2.5/src/muParserBase.cpp index 495fc6e43..e0dc8ff0d 100644 --- a/muparser-2.2.5/src/muParserBase.cpp +++ b/muparser-2.2.5/src/muParserBase.cpp @@ -79,7 +79,6 @@ ParserBase::ParserBase() m_sNameChars(), m_sOprtChars(), m_sInfixOprtChars(), - m_nIfElseCounter(0), m_vStackBuffer(), m_nFinalResultIdx(0) { InitTokenReader(); @@ -144,7 +143,6 @@ void ParserBase::ReInit() const { m_vStringBuf.clear(); m_vRPN.clear(); m_pTokenReader->ReInit(); - m_nIfElseCounter = 0; } //--------------------------------------------------------------------------- @@ -1003,6 +1001,7 @@ ValueOrError ParserBase::ExecuteRPN() const { //--------------------------------------------------------------------------- OptionalError ParserBase::CreateRPN() const { if (!m_pTokenReader->GetExpr().length()) return ParserError(ecUNEXPECTED_EOF, 0); + int ifElseCounter = 0; ParserStack stOpt, stVal; ParserStack stArgCount; @@ -1044,8 +1043,8 @@ OptionalError ParserBase::CreateRPN() const { } case cmELSE: - m_nIfElseCounter--; - if (m_nIfElseCounter < 0) return Error(ecMISPLACED_COLON, m_pTokenReader->GetPos()); + ifElseCounter--; + if (ifElseCounter < 0) return Error(ecMISPLACED_COLON, m_pTokenReader->GetPos()); oerr = ApplyRemainingOprt(stOpt, stVal); if (oerr.has_error()) return oerr.error(); @@ -1111,7 +1110,7 @@ OptionalError ParserBase::CreateRPN() const { // case cmOR: // case cmXOR: case cmIF: - m_nIfElseCounter++; + ifElseCounter++; // fallthrough intentional (no break!) case cmLAND: @@ -1203,7 +1202,7 @@ OptionalError ParserBase::CreateRPN() const { if (ParserBase::g_DbgDumpCmdCode) m_vRPN.AsciiDump(); - if (m_nIfElseCounter > 0) return Error(ecMISSING_ELSE_CLAUSE); + if (ifElseCounter > 0) return Error(ecMISSING_ELSE_CLAUSE); // get the last value (= final result) from the stack assert(stArgCount.size() == 1 && "Expected arg count of 1");