From: luo rixin Date: Mon, 10 Jul 2023 04:03:22 +0000 (+0800) Subject: crush/CrushLocation: use boost trim instead of string erase to improve understandability X-Git-Tag: v19.0.0~847^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F52374%2Fhead;p=ceph.git crush/CrushLocation: use boost trim instead of string erase to improve understandability Signed-off-by: luo rixin --- 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); }