From bb2d99675ee238fc23b6911013ce97bd74cd9f27 Mon Sep 17 00:00:00 2001 From: luo rixin Date: Mon, 10 Jul 2023 12:03:22 +0800 Subject: [PATCH] crush/CrushLocation: use boost trim instead of string erase to improve understandability Signed-off-by: luo rixin --- src/crush/CrushLocation.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/crush/CrushLocation.cc b/src/crush/CrushLocation.cc index fb2ada8d6d27..901ce4f46439 100644 --- a/src/crush/CrushLocation.cc +++ b/src/crush/CrushLocation.cc @@ -2,6 +2,7 @@ // vim: ts=8 sw=2 smarttab #include +#include #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); } -- 2.47.3