diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-11-29 17:20:19 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-11-29 17:20:19 +0100 |
commit | d4864a9440ef3fecb497e1ea7018f927e2e64059 (patch) | |
tree | 6f195b1dec4f6127e6b21327c9244e4772f9c288 /idlc/source | |
parent | 2a2ed5878a79999d405e26a5c586883b19e7b09f (diff) |
Rewrite some (trivial) assignments inside if/while conditions: idlc
Change-Id: I6be338f54dd8e6912e48258c0a2e075dc69b2893
Diffstat (limited to 'idlc/source')
-rw-r--r-- | idlc/source/options.cxx | 6 | ||||
-rw-r--r-- | idlc/source/parser.y | 9 |
2 files changed, 7 insertions, 8 deletions
diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index 9a3eee6daf47..0d02236cac47 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -69,14 +69,16 @@ bool Options::checkArgument (std::vector< std::string > & rArgs, char const * ar switch(arg[0]) { case '@': - if ((result = (len > 1))) + result = len > 1; + if (result) { // "@<cmdfile>" result = Options::checkCommandFile (rArgs, &(arg[1])); } break; case '-': - if ((result = (len > 1))) + result = len > 1; + if (result) { // "-<option>" switch (arg[1]) diff --git a/idlc/source/parser.y b/idlc/source/parser.y index 6e7bf785154f..5589e7482607 100644 --- a/idlc/source/parser.y +++ b/idlc/source/parser.y @@ -445,12 +445,11 @@ module_dcl : AstScope* pScope = idlc()->scopes()->topNonNull(); AstModule* pModule = nullptr; - AstDeclaration* pExists = nullptr; if ( pScope ) { pModule = new AstModule(*$3, pScope); - if( (pExists = pScope->lookupForAdd(pModule)) ) + if( AstDeclaration* pExists = pScope->lookupForAdd(pModule) ) { pExists->setInMainfile(idlc()->isInMainFile()); pExists->setFileName(pModule->getFileName()); @@ -556,7 +555,6 @@ interface_dcl : AstScope* pScope = idlc()->scopes()->topNonNull(); AstInterface* pInterface = nullptr; AstInterface* pForward = nullptr; - AstDeclaration* pDecl = nullptr; /* * Make a new interface node and add it to its enclosing scope @@ -566,7 +564,7 @@ interface_dcl : pInterface = new AstInterface( *$1->getName(), static_cast< AstInterface const * >(resolveTypedefs($1->getInherits())), pScope); - if ( (pDecl = pScope->lookupByName(pInterface->getScopedName())) ) + if ( AstDeclaration* pDecl = pScope->lookupByName(pInterface->getScopedName()) ) { /* * See if we're defining a forward declared interface. @@ -1279,12 +1277,11 @@ constants_dcl : AstScope* pScope = idlc()->scopes()->topNonNull(); AstConstants* pConstants = nullptr; - AstDeclaration* pExists = nullptr; if ( pScope ) { pConstants = new AstConstants(*$3, pScope); - if( (pExists = pScope->lookupForAdd(pConstants)) ) + if( AstDeclaration* pExists = pScope->lookupForAdd(pConstants) ) { pExists->setInMainfile(idlc()->isInMainFile()); delete(pConstants); |