Repository: mesos Updated Branches: refs/heads/master 5a075ced4 -> e2e99de29
Printed empty set if `Resources` instance is empty. Prior to this patch, empty `Resources` instances have been omitted if printed to a stream. This showed up as double space, which is confusing. Now, an empty `Resources` instance is explicitly printed. Prior: <...> with oversubscribed resources (total: <...>, allocated: ) After: <...> with oversubscribed resources {} (total: <...>, allocated: {}) Review: https://reviews.apache.org/r/49903/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e2e99de2 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e2e99de2 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e2e99de2 Branch: refs/heads/master Commit: e2e99de294d0c224a209d63823fbc760ec921c60 Parents: 5a075ce Author: Alexander Rukletsov <ruklet...@gmail.com> Authored: Wed Sep 21 11:11:55 2016 +0200 Committer: Alexander Rukletsov <al...@apache.org> Committed: Wed Sep 21 11:11:55 2016 +0200 ---------------------------------------------------------------------- src/common/resources.cpp | 5 +++++ src/v1/resources.cpp | 5 +++++ 2 files changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/e2e99de2/src/common/resources.cpp ---------------------------------------------------------------------- diff --git a/src/common/resources.cpp b/src/common/resources.cpp index 4602bff..0774ff0 100644 --- a/src/common/resources.cpp +++ b/src/common/resources.cpp @@ -1891,6 +1891,11 @@ ostream& operator<<(ostream& stream, const Resources::Resource_& resource_) ostream& operator<<(ostream& stream, const Resources& resources) { + if (resources.empty()) { + stream << "{}"; + return stream; + } + Resources::const_iterator it = resources.begin(); while (it != resources.end()) { http://git-wip-us.apache.org/repos/asf/mesos/blob/e2e99de2/src/v1/resources.cpp ---------------------------------------------------------------------- diff --git a/src/v1/resources.cpp b/src/v1/resources.cpp index 7c4db44..62a644e 100644 --- a/src/v1/resources.cpp +++ b/src/v1/resources.cpp @@ -1894,6 +1894,11 @@ ostream& operator<<(ostream& stream, const Resources::Resource_& resource_) ostream& operator<<(ostream& stream, const Resources& resources) { + if (resources.empty()) { + stream << "{}"; + return stream; + } + Resources::const_iterator it = resources.begin(); while (it != resources.end()) {