diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-02-17 23:44:45 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-02-18 22:57:59 (GMT) |
commit | f20a4257f2889387fcbf540b29b16f10843f2f9e (patch) | |
tree | 77347012df9b177385eebbe395faba766edeed3e /Source | |
parent | ee269f4f16300b0427c1e1baef94b85ccc4ea13f (diff) | |
download | CMake-f20a4257f2889387fcbf540b29b16f10843f2f9e.zip CMake-f20a4257f2889387fcbf540b29b16f10843f2f9e.tar.gz CMake-f20a4257f2889387fcbf540b29b16f10843f2f9e.tar.bz2 |
cmMakefile: Add flag to result and manipulate in place.
Rather than creating a string, manipulating it, and then
copying it to the result.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefile.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0d0c60a..6fd569e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1340,11 +1340,11 @@ void cmMakefile::AddDefineFlag(const char* flag) void cmMakefile::AddDefineFlag(const char* flag, std::string& dflags) { // remove any \n\r - std::string ret = flag; - std::replace(ret.begin(), ret.end(), '\n', ' '); - std::replace(ret.begin(), ret.end(), '\r', ' '); - dflags += " "; - dflags += ret; + std::string::size_type initSize = dflags.size(); + dflags += std::string(" ") + flag; + std::string::iterator flagStart = dflags.begin() + initSize + 1; + std::replace(flagStart, dflags.end(), '\n', ' '); + std::replace(flagStart, dflags.end(), '\r', ' '); } |