diff options
author | Artur Ryt <artur.ryt@gmail.com> | 2019-03-30 15:11:21 (GMT) |
---|---|---|
committer | Artur Ryt <artur.ryt@gmail.com> | 2019-03-30 15:15:05 (GMT) |
commit | 2d66567dca2a5a80e41493ec0a9d6d86f7d955f5 (patch) | |
tree | 84468e248f456f65c75a99033ba8073e48ea0f5b /Source/CTest/cmCTestSVN.cxx | |
parent | 5bdee3786359b6560eb9ee1d6fab8664feb90db4 (diff) | |
download | CMake-2d66567dca2a5a80e41493ec0a9d6d86f7d955f5.zip CMake-2d66567dca2a5a80e41493ec0a9d6d86f7d955f5.tar.gz CMake-2d66567dca2a5a80e41493ec0a9d6d86f7d955f5.tar.bz2 |
Modernize: Prefer .substr in place of .c_str() + int
A lot of temporary/local strings were created out of C-strings
substr can utilize current string size, so in theory be a little
more efficient.
Diffstat (limited to 'Source/CTest/cmCTestSVN.cxx')
-rw-r--r-- | Source/CTest/cmCTestSVN.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index b7a4e4c..04749b7 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -515,7 +515,7 @@ private: if (path.size() > this->SVN->SourceDirectory.size() && strncmp(path.c_str(), this->SVN->SourceDirectory.c_str(), this->SVN->SourceDirectory.size()) == 0) { - local_path = path.c_str() + this->SVN->SourceDirectory.size() + 1; + local_path = path.substr(this->SVN->SourceDirectory.size() + 1); } else { local_path = path; } @@ -554,7 +554,7 @@ std::string cmCTestSVN::SVNInfo::BuildLocalPath(std::string const& path) const // Add path with base prefix removed if (path.size() > this->Base.size() && strncmp(path.c_str(), this->Base.c_str(), this->Base.size()) == 0) { - local_path += (path.c_str() + this->Base.size()); + local_path += path.substr(this->Base.size()); } else { local_path += path; } |