summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-02-09 13:51:45 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-09 19:57:46 +0100
commit1e56cce16bbe07c6e8e900dd4c4d41b1fcd54614 (patch)
tree864fa68050481a109fb80a4a310243b139212248 /starmath
parentcccc19ca93a8c09bf657fa44d9d26ea6f697afe5 (diff)
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@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/parse.hxx4
-rw-r--r--starmath/source/parse.cxx21
2 files changed, 13 insertions, 12 deletions
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: */