]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Crush:Remove all the before and after space in better way. 7157/head
authorsongbaisen <song.baisen@zte.com.cn>
Fri, 8 Jan 2016 06:45:47 +0000 (14:45 +0800)
committersongbaisen <song.baisen@zte.com.cn>
Mon, 11 Jan 2016 06:42:35 +0000 (14:42 +0800)
Fixes: #14302
Signed-off-by: songbaisen song.baisen@zte.com.cn
src/crush/CrushCompiler.cc

index b4c2e88264d307da06ca696e7997823b732dba71..0203c239fa6350209db771c7931bba7db7a02f50 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <typeinfo>
 #include "common/errno.h"
+#include <boost/algorithm/string.hpp>
 
 // -------------
 
@@ -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)