From 25accda781bc0bc79ca2e887c54ca981068bf407 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 22 Aug 2015 11:58:11 +0200 Subject: tdf#39440 reduce scope of local variables This addresses some cppcheck warnings. Change-Id: I6ab170c4426494ab9fc53017f88e47fbfdbd9aad Reviewed-on: https://gerrit.libreoffice.org/17920 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- idlc/source/astscope.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'idlc/source/astscope.cxx') diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx index c4a84c4d8c2e..cd8a48387496 100644 --- a/idlc/source/astscope.cxx +++ b/idlc/source/astscope.cxx @@ -87,12 +87,11 @@ sal_uInt16 AstScope::getNodeCount(NodeType nodeType) { DeclList::const_iterator iter = getIteratorBegin(); DeclList::const_iterator end = getIteratorEnd(); - AstDeclaration* pDecl = NULL; sal_uInt16 count = 0; while ( iter != end ) { - pDecl = *iter; + AstDeclaration* pDecl = *iter; if ( pDecl->getNodeType() == nodeType ) count++; ++iter; @@ -199,11 +198,10 @@ AstDeclaration* AstScope::lookupByNameLocal(const OString& name) const { DeclList::const_iterator iter(m_declarations.begin()); DeclList::const_iterator end(m_declarations.end()); - AstDeclaration* pDecl = NULL; while ( iter != end ) { - pDecl = *iter; + AstDeclaration* pDecl = *iter; if ( pDecl->getLocalName() == name ) return pDecl; ++iter; -- cgit