diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-05-24 21:10:21 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-05-24 21:22:08 (GMT) |
commit | 34bc6e1f3b2564abfcc79e7724697c2657a56129 (patch) | |
tree | 22874b5da7fdfebaa8ca3fe4f2d912ac750d1b61 | |
parent | a98a699987dde6576399474a24bff42c4d1317ad (diff) | |
download | CMake-34bc6e1f3b2564abfcc79e7724697c2657a56129.zip CMake-34bc6e1f3b2564abfcc79e7724697c2657a56129.tar.gz CMake-34bc6e1f3b2564abfcc79e7724697c2657a56129.tar.bz2 |
cmCTestScriptHandler: don't call find repeatedly.
Also, prefer the character overload.
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0c09cc7..ba0e816 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -330,9 +330,10 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) // passed into the scripts as S_ARG std::string script = total_script_arg; std::string script_arg; - if (total_script_arg.find(",") != std::string::npos) { - script = total_script_arg.substr(0, total_script_arg.find(",")); - script_arg = total_script_arg.substr(total_script_arg.find(",") + 1); + const std::string::size_type comma_pos = total_script_arg.find(','); + if (comma_pos != std::string::npos) { + script = total_script_arg.substr(0, comma_pos); + script_arg = total_script_arg.substr(comma_pos + 1); } // make sure the file exists if (!cmSystemTools::FileExists(script.c_str())) { |