diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-01-25 14:20:56 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-02-17 19:18:58 (GMT) |
commit | 75661fdfd94fef4b8f1e8112aa75d76d1cc366e6 (patch) | |
tree | 5ef25e0ac480ab19e0ca200dbffbf3b4b565b2eb /Source/cmListCommand.cxx | |
parent | 10e53e230811b94701d86e8c78e38df5abf69ee8 (diff) | |
download | CMake-75661fdfd94fef4b8f1e8112aa75d76d1cc366e6.zip CMake-75661fdfd94fef4b8f1e8112aa75d76d1cc366e6.tar.gz CMake-75661fdfd94fef4b8f1e8112aa75d76d1cc366e6.tar.bz2 |
cmListCommand: Move size variable out of loop.
Re-use it where possible in two instances.
Diffstat (limited to 'Source/cmListCommand.cxx')
-rw-r--r-- | Source/cmListCommand.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 98dcef1..0c6adfd 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -202,12 +202,12 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args) std::string value; size_t cc; const char* sep = ""; + size_t nitem = varArgsExpanded.size(); for ( cc = 2; cc < args.size()-1; cc ++ ) { int item = atoi(args[cc].c_str()); value += sep; sep = ";"; - size_t nitem = varArgsExpanded.size(); if ( item < 0 ) { item = (int)nitem + item; @@ -216,8 +216,8 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args) { std::ostringstream str; str << "index: " << item << " out of range (-" - << varArgsExpanded.size() << ", " - << varArgsExpanded.size()-1 << ")"; + << nitem << ", " + << nitem - 1 << ")"; this->SetError(str.str()); return false; } @@ -485,10 +485,10 @@ bool cmListCommand::HandleRemoveAtCommand( size_t cc; std::vector<size_t> removed; + size_t nitem = varArgsExpanded.size(); for ( cc = 2; cc < args.size(); ++ cc ) { int item = atoi(args[cc].c_str()); - size_t nitem = varArgsExpanded.size(); if ( item < 0 ) { item = (int)nitem + item; @@ -497,8 +497,8 @@ bool cmListCommand::HandleRemoveAtCommand( { std::ostringstream str; str << "index: " << item << " out of range (-" - << varArgsExpanded.size() << ", " - << varArgsExpanded.size()-1 << ")"; + << nitem << ", " + << nitem - 1 << ")"; this->SetError(str.str()); return false; } |