diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-08-22 21:42:36 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-08-24 21:39:47 (GMT) |
commit | 5962db438939ef2754509b8578af1f845ec07dc8 (patch) | |
tree | f6b0c0db2acc8dc889d2d5d46fdf75659daa17e7 /Source/CTest/cmCTestGIT.cxx | |
parent | fe19fda2aa2595622c463fccaa8b36a91e4521c4 (diff) | |
download | CMake-5962db438939ef2754509b8578af1f845ec07dc8.zip CMake-5962db438939ef2754509b8578af1f845ec07dc8.tar.gz CMake-5962db438939ef2754509b8578af1f845ec07dc8.tar.bz2 |
Use C++11 nullptr
Diffstat (limited to 'Source/CTest/cmCTestGIT.cxx')
-rw-r--r-- | Source/CTest/cmCTestGIT.cxx | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 230aedf..8c27045 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -58,8 +58,8 @@ std::string cmCTestGIT::GetWorkingRevision() { // Run plumbing "git rev-list" to get work tree revision. const char* git = this->CommandLineTool.c_str(); - const char* git_rev_list[] = { git, "rev-list", "-n", "1", - "HEAD", "--", CM_NULLPTR }; + const char* git_rev_list[] = { git, "rev-list", "-n", "1", + "HEAD", "--", nullptr }; std::string rev; OneLineParser out(this, "rl-out> ", rev); OutputLogger err(this->Log, "rl-err> "); @@ -90,11 +90,11 @@ std::string cmCTestGIT::FindGitDir() // Run "git rev-parse --git-dir" to locate the real .git directory. const char* git = this->CommandLineTool.c_str(); - char const* git_rev_parse[] = { git, "rev-parse", "--git-dir", CM_NULLPTR }; + char const* git_rev_parse[] = { git, "rev-parse", "--git-dir", nullptr }; std::string git_dir_line; OneLineParser rev_parse_out(this, "rev-parse-out> ", git_dir_line); OutputLogger rev_parse_err(this->Log, "rev-parse-err> "); - if (this->RunChild(git_rev_parse, &rev_parse_out, &rev_parse_err, CM_NULLPTR, + if (this->RunChild(git_rev_parse, &rev_parse_out, &rev_parse_err, nullptr, cmProcessOutput::UTF8)) { git_dir = git_dir_line; } @@ -118,7 +118,7 @@ std::string cmCTestGIT::FindGitDir() 0 }; OneLineParser cygpath_out(this, "cygpath-out> ", git_dir_line); OutputLogger cygpath_err(this->Log, "cygpath-err> "); - if (this->RunChild(cygpath, &cygpath_out, &cygpath_err, CM_NULLPTR, + if (this->RunChild(cygpath, &cygpath_out, &cygpath_err, nullptr, cmProcessOutput::UTF8)) { git_dir = git_dir_line; } @@ -134,12 +134,11 @@ std::string cmCTestGIT::FindTopDir() // Run "git rev-parse --show-cdup" to locate the top of the tree. const char* git = this->CommandLineTool.c_str(); - char const* git_rev_parse[] = { git, "rev-parse", "--show-cdup", - CM_NULLPTR }; + char const* git_rev_parse[] = { git, "rev-parse", "--show-cdup", nullptr }; std::string cdup; OneLineParser rev_parse_out(this, "rev-parse-out> ", cdup); OutputLogger rev_parse_err(this->Log, "rev-parse-err> "); - if (this->RunChild(git_rev_parse, &rev_parse_out, &rev_parse_err, CM_NULLPTR, + if (this->RunChild(git_rev_parse, &rev_parse_out, &rev_parse_err, nullptr, cmProcessOutput::UTF8) && !cdup.empty()) { top_dir += "/"; @@ -170,7 +169,7 @@ bool cmCTestGIT::UpdateByFetchAndReset() } // Sentinel argument. - git_fetch.push_back(CM_NULLPTR); + git_fetch.push_back(nullptr); // Fetch upstream refs. OutputLogger fetch_out(this->Log, "fetch-out> "); @@ -205,8 +204,7 @@ bool cmCTestGIT::UpdateByFetchAndReset() } // Reset the local branch to point at that tracked from upstream. - char const* git_reset[] = { git, "reset", "--hard", sha1.c_str(), - CM_NULLPTR }; + char const* git_reset[] = { git, "reset", "--hard", sha1.c_str(), nullptr }; OutputLogger reset_out(this->Log, "reset-out> "); OutputLogger reset_err(this->Log, "reset-err> "); return this->RunChild(&git_reset[0], &reset_out, &reset_err); @@ -221,7 +219,7 @@ bool cmCTestGIT::UpdateByCustom(std::string const& custom) i != git_custom_command.end(); ++i) { git_custom.push_back(i->c_str()); } - git_custom.push_back(CM_NULLPTR); + git_custom.push_back(nullptr); OutputLogger custom_out(this->Log, "custom-out> "); OutputLogger custom_err(this->Log, "custom-err> "); @@ -250,7 +248,7 @@ bool cmCTestGIT::UpdateImpl() // Git < 1.6.5 did not support submodule --recursive if (this->GetGitVersion() < cmCTestGITVersion(1, 6, 5, 0)) { - recursive = CM_NULLPTR; + recursive = nullptr; // No need to require >= 1.6.5 if there are no submodules. if (cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) { this->Log << "Git < 1.6.5 cannot update submodules recursively\n"; @@ -259,7 +257,7 @@ bool cmCTestGIT::UpdateImpl() // Git < 1.8.1 did not support sync --recursive if (this->GetGitVersion() < cmCTestGITVersion(1, 8, 1, 0)) { - sync_recursive = CM_NULLPTR; + sync_recursive = nullptr; // No need to require >= 1.8.1 if there are no submodules. if (cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) { this->Log << "Git < 1.8.1 cannot synchronize submodules recursively\n"; @@ -274,8 +272,7 @@ bool cmCTestGIT::UpdateImpl() std::string init_submodules = this->CTest->GetCTestConfiguration("GITInitSubmodules"); if (cmSystemTools::IsOn(init_submodules.c_str())) { - char const* git_submodule_init[] = { git, "submodule", "init", - CM_NULLPTR }; + char const* git_submodule_init[] = { git, "submodule", "init", nullptr }; ret = this->RunChild(git_submodule_init, &submodule_out, &submodule_err, top_dir.c_str()); @@ -285,7 +282,7 @@ bool cmCTestGIT::UpdateImpl() } char const* git_submodule_sync[] = { git, "submodule", "sync", - sync_recursive, CM_NULLPTR }; + sync_recursive, nullptr }; ret = this->RunChild(git_submodule_sync, &submodule_out, &submodule_err, top_dir.c_str()); @@ -294,7 +291,7 @@ bool cmCTestGIT::UpdateImpl() } char const* git_submodule[] = { git, "submodule", "update", recursive, - CM_NULLPTR }; + nullptr }; return this->RunChild(git_submodule, &submodule_out, &submodule_err, top_dir.c_str()); } @@ -303,7 +300,7 @@ unsigned int cmCTestGIT::GetGitVersion() { if (!this->CurrentGitVersion) { const char* git = this->CommandLineTool.c_str(); - char const* git_version[] = { git, "--version", CM_NULLPTR }; + char const* git_version[] = { git, "--version", nullptr }; std::string version; OneLineParser version_out(this, "version-out> ", version); OutputLogger version_err(this->Log, "version-err> "); @@ -615,10 +612,10 @@ bool cmCTestGIT::LoadRevisions() std::string range = this->OldRevision + ".." + this->NewRevision; const char* git = this->CommandLineTool.c_str(); const char* git_rev_list[] = { git, "rev-list", "--reverse", - range.c_str(), "--", CM_NULLPTR }; + range.c_str(), "--", nullptr }; const char* git_diff_tree[] = { git, "diff-tree", "--stdin", "--always", "-z", - "-r", "--pretty=raw", "--encoding=utf-8", CM_NULLPTR + "-r", "--pretty=raw", "--encoding=utf-8", nullptr }; this->Log << this->ComputeCommandLine(git_rev_list) << " | " << this->ComputeCommandLine(git_diff_tree) << "\n"; @@ -645,19 +642,18 @@ bool cmCTestGIT::LoadModifications() // Use 'git update-index' to refresh the index w.r.t. the work tree. const char* git_update_index[] = { git, "update-index", "--refresh", - CM_NULLPTR }; + nullptr }; OutputLogger ui_out(this->Log, "ui-out> "); OutputLogger ui_err(this->Log, "ui-err> "); - this->RunChild(git_update_index, &ui_out, &ui_err, CM_NULLPTR, + this->RunChild(git_update_index, &ui_out, &ui_err, nullptr, cmProcessOutput::UTF8); // Use 'git diff-index' to get modified files. const char* git_diff_index[] = { git, "diff-index", "-z", - "HEAD", "--", CM_NULLPTR }; + "HEAD", "--", nullptr }; DiffParser out(this, "di-out> "); OutputLogger err(this->Log, "di-err> "); - this->RunChild(git_diff_index, &out, &err, CM_NULLPTR, - cmProcessOutput::UTF8); + this->RunChild(git_diff_index, &out, &err, nullptr, cmProcessOutput::UTF8); for (std::vector<Change>::const_iterator ci = out.Changes.begin(); ci != out.Changes.end(); ++ci) { |