From 8e65f455f00f01db79d7b6f8611d3f481869ec8d Mon Sep 17 00:00:00 2001 From: songbaisen Date: Fri, 8 Jan 2016 14:45:47 +0800 Subject: [PATCH] Crush:Remove all the before and after space in better way. Fixes: #14302 Signed-off-by: songbaisen song.baisen@zte.com.cn --- src/crush/CrushCompiler.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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) -- 2.47.3