diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-01-23 00:03:45 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-02-11 21:58:08 (GMT) |
commit | 0b61b86df856e3cec366f8c23f35aae576b2d821 (patch) | |
tree | 871c9a2bfbf68e36f0db753e5992848cfb3cfd92 /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | e21f7829a2891ce7599ade02d4fd9c193657069a (diff) | |
download | CMake-0b61b86df856e3cec366f8c23f35aae576b2d821.zip CMake-0b61b86df856e3cec366f8c23f35aae576b2d821.tar.gz CMake-0b61b86df856e3cec366f8c23f35aae576b2d821.tar.bz2 |
Handle last element outside of the loop.
There is no point in checking on each loop iteration whether
it is the last element.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 54d330f..32da821 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2298,10 +2298,9 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, // Now add the rest of the components separated by the proper slash // direction for this platform. bool first = true; - for(unsigned int i=1; i < components.size(); ++i) + for(unsigned int i=1; i < components.size() - 1; ++i) { - // Only the last component can be empty to avoid double slashes. - if(!components[i].empty() || (i == (components.size()-1))) + if(!components[i].empty()) { if(!first) { @@ -2311,6 +2310,15 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, first = false; } } + if (components.size() > 1) + { + // Only the last component can be empty to avoid double slashes. + if(!first) + { + result += slash; + } + result += components.back(); + } } // Close the quoted result. |