summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-16 16:50:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-17 13:26:41 +0200
commitd375324a86c5cd4647da5036e846e9c648f97c9c (patch)
treebf7c1806f1b4e95c106b69013c8b37f8cde53842 /sc/source
parent77519d83eb796f75d73e872356e4100017673653 (diff)
loplugin:useuniqueptr in CachedTokenArray
Change-Id: If65de2af34b6f2013feee96332078c1cfa167dcf Reviewed-on: https://gerrit.libreoffice.org/57524 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/filter/oox/formulabuffer.cxx10
1 files changed, 2 insertions, 8 deletions
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index 114a998b8832..0561bba62e92 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -58,12 +58,6 @@ public:
explicit CachedTokenArray( ScDocument& rDoc ) :
maCxt(&rDoc, formula::FormulaGrammar::GRAM_OOXML) {}
- ~CachedTokenArray()
- {
- for (const std::pair<SCCOL, Item*>& rCacheItem : maCache)
- delete rCacheItem.second;
- }
-
Item* get( const ScAddress& rPos, const OUString& rFormula )
{
// Check if a token array is cached for this column.
@@ -87,7 +81,7 @@ public:
{
// Create an entry for this column.
std::pair<ColCacheType::iterator,bool> r =
- maCache.emplace(rPos.Col(), new Item);
+ maCache.emplace(rPos.Col(), o3tl::make_unique<Item>());
if (!r.second)
// Insertion failed.
return;
@@ -101,7 +95,7 @@ public:
}
private:
- typedef std::unordered_map<SCCOL, Item*> ColCacheType;
+ typedef std::unordered_map<SCCOL, std::unique_ptr<Item>> ColCacheType;
ColCacheType maCache;
sc::TokenStringContext maCxt;
};