[gnome-system-monitor] Simpler string building with procman::join.
- From: Benoît Dejean <bdejean src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Simpler string building with procman::join.
- Date: Fri, 28 Oct 2016 13:45:49 +0000 (UTC)
commit d755fad2766ff8e7ac6e4c8117bf8e588841f432
Author: Benoît Dejean <bdejean gmail com>
Date: Fri Oct 28 15:20:18 2016 +0200
Simpler string building with procman::join.
src/cgroups.cpp | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/cgroups.cpp b/src/cgroups.cpp
index 3080fdc..23d10c1 100644
--- a/src/cgroups.cpp
+++ b/src/cgroups.cpp
@@ -91,22 +91,15 @@ get_process_cgroup_string(pid_t pid) {
// name (cat1, cat2), ...
// sorted by name, categories
- std::string groups;
+ std::vector<std::string> groups;
for (auto& i : names) {
- std::string cats;
std::sort(begin(i.second), end(i.second));
-
- for (const auto & cat : i.second) {
- if (!cats.empty()) { cats += ", "; }
- cats += cat;
- }
-
- if (!groups.empty()) { groups += ", "; }
- groups += i.first + " (" + cats + ')';
+ std::string cats = procman::join(i.second, ", ");
+ groups.push_back(i.first + " (" + cats + ')');
}
- it.first->second = std::move(groups);
+ it.first->second = procman::join(groups, ", ");
}
return it.first->second;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]