[Libreoffice-commits] core.git: starmath/inc starmath/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Tue Feb 9 18:58:27 UTC 2021
starmath/inc/parse.hxx | 4 ++--
starmath/source/parse.cxx | 21 +++++++++++----------
2 files changed, 13 insertions(+), 12 deletions(-)
New commits:
commit 1e56cce16bbe07c6e8e900dd4c4d41b1fcd54614
Author: Noel <noel.grandin at collabora.co.uk>
AuthorDate: Tue Feb 9 13:51:45 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Feb 9 19:57:46 2021 +0100
no need to use unique_ptr for a simple value class
Change-Id: Id83cd16fe3eb815ad419cc331e65fb731161bd30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110635
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index 6349dc8c479f..752cde6b23e5 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -93,7 +93,7 @@ class SmParser
{
OUString m_aBufferString;
SmToken m_aCurToken;
- std::vector<std::unique_ptr<SmErrorDesc>> m_aErrDescList;
+ std::vector<SmErrorDesc> m_aErrDescList;
int m_nCurError;
sal_Int32 m_nBufferIndex,
m_nTokenIndex;
@@ -194,7 +194,7 @@ public:
const SmErrorDesc* NextError();
const SmErrorDesc* PrevError();
- const SmErrorDesc* GetError();
+ const SmErrorDesc* GetError() const;
const std::set< OUString >& GetUsedSymbols() const { return m_aUsedSymbols; }
};
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 0aa1518eb4c2..8e3afd989b1e 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -2599,8 +2599,8 @@ std::unique_ptr<SmExpressionNode> SmParser::DoError(SmParseError eError)
xSNode->SetSubNode(0, pErr);
// Append error to the error list
- SmErrorDesc* pErrDesc = new SmErrorDesc(eError, xSNode.get(), m_aCurToken.cMathChar);
- m_aErrDescList.push_back(std::unique_ptr<SmErrorDesc>(pErrDesc));
+ SmErrorDesc aErrDesc(eError, xSNode.get(), m_aCurToken.cMathChar);
+ m_aErrDescList.push_back(aErrDesc);
NextToken();
@@ -2659,11 +2659,11 @@ std::unique_ptr<SmNode> SmParser::ParseExpression(const OUString &rBuffer)
const SmErrorDesc *SmParser::NextError()
{
if ( !m_aErrDescList.empty() )
- if (m_nCurError > 0) return m_aErrDescList[ --m_nCurError ].get();
+ if (m_nCurError > 0) return &m_aErrDescList[ --m_nCurError ];
else
{
m_nCurError = 0;
- return m_aErrDescList[ m_nCurError ].get();
+ return &m_aErrDescList[ m_nCurError ];
}
else return nullptr;
}
@@ -2672,21 +2672,22 @@ const SmErrorDesc *SmParser::NextError()
const SmErrorDesc *SmParser::PrevError()
{
if ( !m_aErrDescList.empty() )
- if (m_nCurError < static_cast<int>(m_aErrDescList.size() - 1)) return m_aErrDescList[ ++m_nCurError ].get();
+ if (m_nCurError < static_cast<int>(m_aErrDescList.size() - 1))
+ return &m_aErrDescList[ ++m_nCurError ];
else
{
m_nCurError = static_cast<int>(m_aErrDescList.size() - 1);
- return m_aErrDescList[ m_nCurError ].get();
+ return &m_aErrDescList[ m_nCurError ];
}
else return nullptr;
}
-const SmErrorDesc *SmParser::GetError()
+const SmErrorDesc* SmParser::GetError() const
{
- if ( !m_aErrDescList.empty() )
- return m_aErrDescList.front().get();
- return nullptr;
+ if (m_aErrDescList.empty())
+ return nullptr;
+ return &m_aErrDescList.front();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list