You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bb...@apache.org on 2020/01/17 14:57:26 UTC

[mesos] branch master updated: Removed unintentional copies of for loop iteration variables.

This is an automated email from the ASF dual-hosted git repository.

bbannier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 5ce5d20  Removed unintentional copies of for loop iteration variables.
5ce5d20 is described below

commit 5ce5d20360b82da6bc0dda5fed82748b0812aa67
Author: Benjamin Bannier <bb...@apache.org>
AuthorDate: Fri Jan 17 15:10:17 2020 +0100

    Removed unintentional copies of for loop iteration variables.
    
    Review: https://reviews.apache.org/r/72011/
---
 src/master/validation.cpp                                   | 2 +-
 src/slave/container_loggers/lib_logrotate.cpp               | 2 +-
 src/slave/containerizer/mesos/provisioner/backends/copy.cpp | 4 ++--
 src/slave/gc.cpp                                            | 2 +-
 src/tests/sorter_tests.cpp                                  | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/master/validation.cpp b/src/master/validation.cpp
index d628bb3..2f80536 100644
--- a/src/master/validation.cpp
+++ b/src/master/validation.cpp
@@ -2579,7 +2579,7 @@ Option<Error> validate(
     return Error("Not a persistent volume: " + error->message);
   }
 
-  foreach (const Resource volume, volumes) {
+  foreach (const Resource& volume, volumes) {
     if (Resources::hasResourceProvider(volume)) {
       continue;
     }
diff --git a/src/slave/container_loggers/lib_logrotate.cpp b/src/slave/container_loggers/lib_logrotate.cpp
index 3ecd83e..48c266c 100644
--- a/src/slave/container_loggers/lib_logrotate.cpp
+++ b/src/slave/container_loggers/lib_logrotate.cpp
@@ -120,7 +120,7 @@ public:
       // Search the environment for prefixed environment variables.
       // We un-prefix those variables before parsing the flag values.
       map<string, string> containerEnvironment;
-      foreach (const Environment::Variable variable,
+      foreach (const Environment::Variable& variable,
                containerConfig.command_info().environment().variables()) {
         if (strings::startsWith(
               variable.name(), flags.environment_variable_prefix)) {
diff --git a/src/slave/containerizer/mesos/provisioner/backends/copy.cpp b/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
index 4afef7f..f1cecd0 100644
--- a/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
+++ b/src/slave/containerizer/mesos/provisioner/backends/copy.cpp
@@ -120,7 +120,7 @@ Future<Option<vector<Path>>> CopyBackendProcess::provision(
 
   vector<Future<Nothing>> futures{Nothing()};
 
-  foreach (const string layer, layers) {
+  foreach (const string& layer, layers) {
     futures.push_back(
         futures.back().then(
             defer(self(), &Self::_provision, layer, rootfs)));
@@ -293,7 +293,7 @@ Future<Nothing> CopyBackendProcess::_provision(
       }
 
       // Remove the whiteout files from rootfs.
-      foreach (const string whiteout, whiteouts) {
+      foreach (const string& whiteout, whiteouts) {
         Try<Nothing> rm = os::rm(whiteout);
         if (rm.isError()) {
           return Failure(
diff --git a/src/slave/gc.cpp b/src/slave/gc.cpp
index 450bbef..2a15807 100644
--- a/src/slave/gc.cpp
+++ b/src/slave/gc.cpp
@@ -183,7 +183,7 @@ void GarbageCollectorProcess::remove(const Timeout& removalTime)
   if (paths.count(removalTime) > 0) {
     list<Owned<PathInfo>> infos;
 
-    foreach (const Owned<PathInfo> info, paths.get(removalTime)) {
+    foreach (const Owned<PathInfo>& info, paths.get(removalTime)) {
       if (info->removing) {
         VLOG(1) << "Skipping deletion of '" << info-> path
                 << "'  as it is already in progress";
diff --git a/src/tests/sorter_tests.cpp b/src/tests/sorter_tests.cpp
index 472691d..bf24a76 100644
--- a/src/tests/sorter_tests.cpp
+++ b/src/tests/sorter_tests.cpp
@@ -135,7 +135,7 @@ TEST(RandomSorterTest, HierarchicalProbabilityDistribution)
     sorter.activate(client);
   }
 
-  for (const pair<string, double> weight : weights) {
+  for (const pair<string, double>& weight : weights) {
     sorter.updateWeight(weight.first, weight.second);
   }