summaryrefslogtreecommitdiff
path: root/rsc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-10 13:36:34 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-11-11 07:16:20 +0000
commitdb17d3c17c40d6b0e92392cf3c6e343d1d17b771 (patch)
tree9d562fcf764e7717df9585ef0e735a12ea4aaa16 /rsc
parent2ce9e4be4a438203382cb9cca824ce3e90647f3a (diff)
new loplugin: memoryvar
detect when we can convert a new/delete sequence on a local variable to use std::unique_ptr Change-Id: Iecae4e4197eccdfacfce2eed39aa4a69e4a660bc Reviewed-on: https://gerrit.libreoffice.org/19884 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'rsc')
-rw-r--r--rsc/source/prj/gui.cxx16
1 files changed, 6 insertions, 10 deletions
diff --git a/rsc/source/prj/gui.cxx b/rsc/source/prj/gui.cxx
index 540563895f44..3a0f0609ca19 100644
--- a/rsc/source/prj/gui.cxx
+++ b/rsc/source/prj/gui.cxx
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <memory>
#include <gui.hxx>
#include <rscrsc.hxx>
@@ -48,26 +49,21 @@ int rsc2_main( int argc, char **argv )
ERRTYPE aError;
InitRscCompiler();
- RscError* pErrHdl = new RscError( lcl_determineVerbosity( argc, argv ) );
- RscCmdLine* pCmdLine = new RscCmdLine( argc, argv, pErrHdl );
- RscTypCont* pTypCont = new RscTypCont( pErrHdl,
+ std::unique_ptr<RscError> pErrHdl(new RscError( lcl_determineVerbosity( argc, argv ) ));
+ std::unique_ptr<RscCmdLine> pCmdLine(new RscCmdLine( argc, argv, pErrHdl.get() ));
+ std::unique_ptr<RscTypCont> pTypCont(new RscTypCont( pErrHdl.get(),
pCmdLine->nByteOrder,
pCmdLine->aPath,
- pCmdLine->nCommands );
+ pCmdLine->nCommands ));
if( pErrHdl->nErrors )
aError = ERR_ERROR;
else{
- RscCompiler* pCompiler = new RscCompiler( pCmdLine, pTypCont );
+ std::unique_ptr<RscCompiler> pCompiler(new RscCompiler( pCmdLine.get(), pTypCont.get() ));
aError = pCompiler->Start();
-
- delete pCompiler;
}
- delete pTypCont;
- delete pCmdLine;
- delete pErrHdl;
delete pHS; // wird durch InitRscCompiler erzeugt
if( aError.IsOk() )