summaryrefslogtreecommitdiffstats
path: root/src/crush/CrushLocation.cc
diff options
context:
space:
mode:
authorluo rixin <luorixin@huawei.com>2023-07-10 06:03:22 +0200
committerluo rixin <luorixin@huawei.com>2023-07-11 05:52:37 +0200
commitbb2d99675ee238fc23b6911013ce97bd74cd9f27 (patch)
treebd6f347c50d82e7a75377a937e2bc168c0c28abf /src/crush/CrushLocation.cc
parentcrush/CrushLocation: remove useless flag (diff)
downloadceph-bb2d99675ee238fc23b6911013ce97bd74cd9f27.tar.xz
ceph-bb2d99675ee238fc23b6911013ce97bd74cd9f27.zip
crush/CrushLocation: use boost trim instead of string erase to improve understandability
Signed-off-by: luo rixin <luorixin@huawei.com>
Diffstat (limited to 'src/crush/CrushLocation.cc')
-rw-r--r--src/crush/CrushLocation.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/crush/CrushLocation.cc b/src/crush/CrushLocation.cc
index fb2ada8d6d2..901ce4f4643 100644
--- a/src/crush/CrushLocation.cc
+++ b/src/crush/CrushLocation.cc
@@ -2,6 +2,7 @@
// vim: ts=8 sw=2 smarttab
#include <vector>
+#include <boost/algorithm/string/trim.hpp>
#include "CrushLocation.h"
#include "CrushWrapper.h"
@@ -90,7 +91,7 @@ int CrushLocation::update_from_hook()
std::string out;
bl.begin().copy(bl.length(), out);
- out.erase(out.find_last_not_of(" \n\r\t")+1);
+ boost::algorithm::trim_right_if(out, boost::algorithm::is_any_of(" \n\r\t"));
return _parse(out);
}