You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/01/20 22:42:31 UTC
mesos git commit: Uses adaptor::reverse for reverse iteration in the
code base.
Repository: mesos
Updated Branches:
refs/heads/master cde429dd2 -> 40953089a
Uses adaptor::reverse for reverse iteration in the code base.
Review: https://reviews.apache.org/r/42509/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/40953089
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/40953089
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/40953089
Branch: refs/heads/master
Commit: 40953089ab7fe1d71d69bd4874e274bb270850ab
Parents: cde429d
Author: haosdent huang <ha...@gmail.com>
Authored: Wed Jan 20 13:42:21 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Jan 20 13:42:21 2016 -0800
----------------------------------------------------------------------
src/common/protobuf_utils.cpp | 10 +++++-----
src/slave/containerizer/mesos/containerizer.cpp | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/40953089/src/common/protobuf_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/protobuf_utils.cpp b/src/common/protobuf_utils.cpp
index 155e4d8..53324ab 100644
--- a/src/common/protobuf_utils.cpp
+++ b/src/common/protobuf_utils.cpp
@@ -21,6 +21,8 @@
#include <process/clock.hpp>
#include <process/pid.hpp>
+#include <stout/adaptor.hpp>
+#include <stout/foreach.hpp>
#include <stout/net.hpp>
#include <stout/stringify.hpp>
#include <stout/uuid.hpp>
@@ -204,11 +206,9 @@ Option<ContainerStatus> getTaskContainerStatus(const Task& task)
// The statuses list only keeps the most recent TaskStatus for
// each state, and appends later states at the end. Let's find
// the most recent TaskStatus with a valid container_status.
- for (auto status = task.statuses().rbegin();
- status != task.statuses().rend();
- ++status) {
- if (status->has_container_status()) {
- return status->container_status();
+ foreach (const TaskStatus& status, adaptor::reverse(task.statuses())) {
+ if (status.has_container_status()) {
+ return status.container_status();
}
}
return None();
http://git-wip-us.apache.org/repos/asf/mesos/blob/40953089/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 68dc150..075b3ab 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -26,6 +26,8 @@
#include <process/reap.hpp>
#include <process/subprocess.hpp>
+#include <stout/adaptor.hpp>
+#include <stout/foreach.hpp>
#include <stout/fs.hpp>
#include <stout/lambda.hpp>
#include <stout/os.hpp>
@@ -1501,9 +1503,7 @@ Future<list<Future<Nothing>>> MesosContainerizerProcess::cleanupIsolators(
// NOTE: We clean up each isolator in the reverse order they were
// prepared (see comment in prepare()).
- for (auto it = isolators.crbegin(); it != isolators.crend(); ++it) {
- const Owned<Isolator>& isolator = *it;
-
+ foreach (const Owned<Isolator>& isolator, adaptor::reverse(isolators)) {
// We'll try to clean up all isolators, waiting for each to
// complete and continuing if one fails.
// TODO(jieyu): Technically, we cannot bind 'isolator' here