martinzink commented on code in PR #2021:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2021#discussion_r2321071361


##########
minifi_main/MiNiFiMain.cpp:
##########
@@ -423,22 +422,22 @@ int main(int argc, char **argv) {
     if (disk_space_watchdog_enable) {
       try {
         const auto repo_paths = [&] {
-          std::vector<std::string> repo_paths;
-          repo_paths.reserve(3);
+          std::vector<std::string> paths;
+          paths.reserve(3);
           // REPOSITORY_DIRECTORY is a dummy path used by noop repositories
           const auto path_valid = [](const std::string& p) { return !p.empty() 
&& p != org::apache::nifi::minifi::core::REPOSITORY_DIRECTORY; };
           auto prov_repo_path = prov_repo->getDirectory();
           auto flow_repo_path = flow_repo->getDirectory();
           auto content_repo_storage_path = content_repo->getStoragePath();
-          if (!prov_repo->isNoop() && path_valid(prov_repo_path)) { 
repo_paths.push_back(std::move(prov_repo_path)); }
-          if (!flow_repo->isNoop() && path_valid(flow_repo_path)) { 
repo_paths.push_back(std::move(flow_repo_path)); }
-          if (path_valid(content_repo_storage_path)) { 
repo_paths.push_back(std::move(content_repo_storage_path)); }
-          return repo_paths;
+          if (!prov_repo->isNoop() && path_valid(prov_repo_path)) { 
paths.push_back(std::move(prov_repo_path)); }
+          if (!flow_repo->isNoop() && path_valid(flow_repo_path)) { 
paths.push_back(std::move(flow_repo_path)); }
+          if (path_valid(content_repo_storage_path)) { 
paths.push_back(std::move(content_repo_storage_path)); }
+          return paths;
         }();
         const auto available_spaces = 
minifi::disk_space_watchdog::check_available_space(repo_paths, logger.get());
         const auto config = 
minifi::disk_space_watchdog::read_config(*configure);
         const auto min_space = [](const std::vector<std::uintmax_t>& spaces) {
-          const auto it = std::min_element(std::begin(spaces), 
std::end(spaces));
+          const auto it = ranges::min_element(spaces);

Review Comment:
   absolutely 👍  [use 
std::ranges](https://github.com/apache/nifi-minifi-cpp/pull/2021/commits/170f0e638b6557f7614703cb9c4387b0905bba56)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to