From: songbaisen Date: Fri, 8 Jan 2016 06:45:47 +0000 (+0800) Subject: Crush:Remove all the before and after space in better way. X-Git-Tag: v10.0.3~73^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8e65f455f00f01db79d7b6f8611d3f481869ec8d;p=ceph.git Crush:Remove all the before and after space in better way. Fixes: #14302 Signed-off-by: songbaisen song.baisen@zte.com.cn --- diff --git a/src/crush/CrushCompiler.cc b/src/crush/CrushCompiler.cc index b4c2e88264d3..0203c239fa63 100644 --- a/src/crush/CrushCompiler.cc +++ b/src/crush/CrushCompiler.cc @@ -19,6 +19,7 @@ #include #include "common/errno.h" +#include // ------------- @@ -326,11 +327,7 @@ int CrushCompiler::decompile(ostream &out) string CrushCompiler::string_node(node_t &node) { - string s = string(node.value.begin(), node.value.end()); - while (s.length() > 0 && - s[0] == ' ') - s = string(s.begin() + 1, s.end()); - return s; + return boost::trim_copy(string(node.value.begin(), node.value.end())); } int CrushCompiler::int_node(node_t &node)