diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-08-15 21:32:27 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-20 17:12:11 +0200 |
commit | 0787ce8814e37972a0c968f60008d4e8722b6e27 (patch) | |
tree | 9d2803ebda8813e6b3f2bc2e6f8a74953b2931c1 /sal/qa | |
parent | d2c9c60fefb9687adbde4be61ed66a5123a2587f (diff) |
Simplify containers iterations, tdf#96099 follow-up
Use range-based loop or replace with std::any_of, std::find and
std::find_if where applicable.
Change-Id: I2f80788c49d56094c29b102eb96a7a7c079567c6
Reviewed-on: https://gerrit.libreoffice.org/59143
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/osl/process/osl_process.cxx | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx index 317682238e49..08b39e1e8357 100644 --- a/sal/qa/osl/process/osl_process.cxx +++ b/sal/qa/osl/process/osl_process.cxx @@ -92,10 +92,8 @@ public: explicit exclude(const std::vector<OString>& exclude_list) { - auto iter = exclude_list.cbegin(); - auto iter_end = exclude_list.cend(); - for (/**/; iter != iter_end; ++iter) - exclude_list_.push_back(env_var_name(*iter)); + for (auto& exclude_list_item : exclude_list) + exclude_list_.push_back(env_var_name(exclude_list_item)); } bool operator() (const OString& env_var) const @@ -259,8 +257,8 @@ public: std::vector<OString> parent_env; read_parent_environment(&parent_env); - for (auto iter = parent_env.cbegin(), end = parent_env.cend(); iter != end; ++iter) - std::cout << "initially parent env: " << *iter << "\n"; + for (auto& env : parent_env) + std::cout << "initially parent env: " << env << "\n"; //remove the environment variables that we have changed //in the child environment from the read parent environment @@ -268,16 +266,16 @@ public: std::remove_if(parent_env.begin(), parent_env.end(), exclude(different_env_vars)), parent_env.end()); - for (auto iter = parent_env.cbegin(), end = parent_env.cend(); iter != end; ++iter) - std::cout << "stripped parent env: " << *iter << "\n"; + for (auto& env : parent_env) + std::cout << "stripped parent env: " << env << "\n"; //read the child environment and exclude the variables that //are different std::vector<OString> child_env; read_child_environment(&child_env); - for (auto iter = child_env.cbegin(), end = child_env.cend(); iter != end; ++iter) - std::cout << "initial child env: " << *iter << "\n"; + for (auto& env : child_env) + std::cout << "initial child env: " << env << "\n"; //partition the child environment into the variables that //are different to the parent environment (they come first) //and the variables that should be equal between parent @@ -288,17 +286,17 @@ public: std::vector<OString> different_child_env_vars(child_env.begin(), iter_logical_end); child_env.erase(child_env.begin(), iter_logical_end); - for (auto iter = child_env.cbegin(), end = child_env.cend(); iter != end; ++iter) - std::cout << "stripped child env: " << *iter << "\n"; + for (auto& env : child_env) + std::cout << "stripped child env: " << env << "\n"; bool common_env_size_equals = (parent_env.size() == child_env.size()); bool common_env_content_equals = std::equal(child_env.begin(), child_env.end(), parent_env.begin()); - for (auto iter = different_env_vars.cbegin(), end = different_env_vars.cend(); iter != end; ++iter) - std::cout << "different should be: " << *iter << "\n"; + for (auto& env_var : different_env_vars) + std::cout << "different should be: " << env_var << "\n"; - for (auto iter = different_child_env_vars.cbegin(), end = different_child_env_vars.cend(); iter != end; ++iter) - std::cout << "different are: " << *iter << "\n"; + for (auto& env_var : different_child_env_vars) + std::cout << "different are: " << env_var << "\n"; bool different_env_size_equals = (different_child_env_vars.size() == different_env_vars.size()); bool different_env_content_equals = |