From b48ea26a9d3b4384874554fe64edfce8784a9255 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 26 Apr 2015 12:39:53 +0200 Subject: [PATCH] cmDefinitions: Invert conditional code. Return the simple case first. --- Source/cmDefinitions.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 115e30a4f..61328be60 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -29,13 +29,14 @@ cmDefinitions::GetInternal(const std::string& key) { return i->second; } - if(cmDefinitions* up = this->Up) + cmDefinitions* up = this->Up; + if(!up) { - // Query the parent scope and store the result locally. - Def def = up->GetInternal(key); - return this->Map.insert(MapType::value_type(key, def)).first->second; + return this->NoDef; } - return this->NoDef; + // Query the parent scope and store the result locally. + Def def = up->GetInternal(key); + return this->Map.insert(MapType::value_type(key, def)).first->second; } //----------------------------------------------------------------------------