[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jul 17 11:27:04 UTC 2018


 sc/source/filter/oox/formulabuffer.cxx |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit d375324a86c5cd4647da5036e846e9c648f97c9c
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 16 16:50:02 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 17 13:26:41 2018 +0200

    loplugin:useuniqueptr in CachedTokenArray
    
    Change-Id: If65de2af34b6f2013feee96332078c1cfa167dcf
    Reviewed-on: https://gerrit.libreoffice.org/57524
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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;
 };


More information about the Libreoffice-commits mailing list