summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-22 13:25:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-05-23 09:31:20 +0200
commitd1e47b1428abf1732ab4d5e219b210760d4152e0 (patch)
tree8eac1def834ba548c45a8a1a18e8e39d45eedc1d /sc
parent919a4ef592b6026a7533a93682f39118fef29ce8 (diff)
enhance useuniqueptr loplugin
teach it to look for the following sequence in a destructor: delete m_pfoo; m_pfoo = nullptr; Change-Id: Icd6271a63a024e32b53cc9e599f8f59952160380 Reviewed-on: https://gerrit.libreoffice.org/37900 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/compiler.hxx3
-rw-r--r--sc/source/core/tool/compiler.cxx4
2 files changed, 3 insertions, 4 deletions
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index cfd5affb0b8f..9e73783f1f28 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -33,6 +33,7 @@
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/sheet/ExternalLinkInfo.hpp>
#include <vector>
+#include <memory>
#include <formula/FormulaCompiler.hxx>
#include <o3tl/typed_flags_set.hxx>
@@ -244,7 +245,7 @@ public:
virtual ScCharFlags getCharTableFlags( sal_Unicode c, sal_Unicode cLast ) const = 0;
protected:
- const ScCharFlags* mpCharTable;
+ std::unique_ptr<ScCharFlags[]> mpCharTable;
};
friend struct Convention;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 8e552a878f81..e8af73691b29 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -290,8 +290,6 @@ OUString ScCompiler::FindAddInFunction( const OUString& rUpperName, bool bLocalF
ScCompiler::Convention::~Convention()
{
- delete [] mpCharTable;
- mpCharTable = nullptr;
}
ScCompiler::Convention::Convention( FormulaGrammar::AddressConvention eConv )
@@ -302,7 +300,7 @@ ScCompiler::Convention::Convention( FormulaGrammar::AddressConvention eConv )
ScCharFlags *t= new ScCharFlags [128];
ScCompiler::pConventions[ meConv ] = this;
- mpCharTable = t;
+ mpCharTable.reset( t );
for (i = 0; i < 128; i++)
t[i] = ScCharFlags::Illegal;