diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-01-14 20:27:25 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-02-11 21:57:55 (GMT) |
commit | 27c6f017a1ef7c62f7f0332d624add7e8189f81c (patch) | |
tree | 5a8c5eb60837b1892092f79905d287950658e552 /Source/cmFileCommand.cxx | |
parent | 4e78ebbdf94b99f7b7d5b9b31d05dd9479b1d6ab (diff) | |
download | CMake-27c6f017a1ef7c62f7f0332d624add7e8189f81c.zip CMake-27c6f017a1ef7c62f7f0332d624add7e8189f81c.tar.gz CMake-27c6f017a1ef7c62f7f0332d624add7e8189f81c.tar.bz2 |
Use cmJoin to accumulate string ranges.
Avoid using the std::accumulate algorithm which is designed for
numeric types, not complex types. It introduces unneccessary
copies.
Initialize variables where they are populated.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 8b893bc..212603c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -217,7 +217,6 @@ bool cmFileCommand bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, bool append) { - std::string message; std::vector<std::string>::const_iterator i = args.begin(); i++; // Get rid of subcommand @@ -231,10 +230,6 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, i++; - for(;i != args.end(); ++i) - { - message += *i; - } if ( !this->Makefile->CanIWriteThisFile(fileName.c_str()) ) { std::string e @@ -272,6 +267,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, this->SetError(error); return false; } + std::string message = cmJoin(cmRange(i, args.end()), std::string()); file << message; file.close(); if(mode) |