diff options
author | Artur Ryt <artur.ryt@gmail.com> | 2019-02-14 19:39:24 (GMT) |
---|---|---|
committer | Artur Ryt <artur.ryt@gmail.com> | 2019-02-15 22:40:30 (GMT) |
commit | 706b93fa558c5a2e0e45a7068b5039d1f40fbc90 (patch) | |
tree | 6f0e1695ac30f5e4d18eb12ac45094456ca401a4 /Source/cmake.cxx | |
parent | 8c4de819449bbb1710b1cc2440357757e5cb757c (diff) | |
download | CMake-706b93fa558c5a2e0e45a7068b5039d1f40fbc90.zip CMake-706b93fa558c5a2e0e45a7068b5039d1f40fbc90.tar.gz CMake-706b93fa558c5a2e0e45a7068b5039d1f40fbc90.tar.bz2 |
Modernize: C-arrays and loops over them
It replaces C arrays with deduced std::initializer_lists
or std::array what makes enables for-loop over them.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ff6b04b..af3e465 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -99,6 +99,7 @@ #include "cmsys/RegularExpression.hxx" #include <algorithm> #include <cstring> +#include <initializer_list> #include <iostream> #include <iterator> #include <memory> // IWYU pragma: keep @@ -1892,11 +1893,10 @@ bool cmake::LoadCache(const std::string& path, bool internal, std::set<std::string>& includes) { bool result = this->State->LoadCache(path, internal, excludes, includes); - static const char* entries[] = { "CMAKE_CACHE_MAJOR_VERSION", - "CMAKE_CACHE_MINOR_VERSION" }; - for (const char* const* nameIt = cm::cbegin(entries); - nameIt != cm::cend(entries); ++nameIt) { - this->UnwatchUnusedCli(*nameIt); + static const auto entries = { "CMAKE_CACHE_MAJOR_VERSION", + "CMAKE_CACHE_MINOR_VERSION" }; + for (auto const& entry : entries) { + this->UnwatchUnusedCli(entry); } return result; } @@ -1904,13 +1904,12 @@ bool cmake::LoadCache(const std::string& path, bool internal, bool cmake::SaveCache(const std::string& path) { bool result = this->State->SaveCache(path, this->GetMessenger()); - static const char* entries[] = { "CMAKE_CACHE_MAJOR_VERSION", - "CMAKE_CACHE_MINOR_VERSION", - "CMAKE_CACHE_PATCH_VERSION", - "CMAKE_CACHEFILE_DIR" }; - for (const char* const* nameIt = cm::cbegin(entries); - nameIt != cm::cend(entries); ++nameIt) { - this->UnwatchUnusedCli(*nameIt); + static const auto entries = { "CMAKE_CACHE_MAJOR_VERSION", + "CMAKE_CACHE_MINOR_VERSION", + "CMAKE_CACHE_PATCH_VERSION", + "CMAKE_CACHEFILE_DIR" }; + for (auto const& entry : entries) { + this->UnwatchUnusedCli(entry); } return result; } |