]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: lc cleanup homebrewed split with boost::split 14906/head
authorJiaying Ren <jiaying.ren@umcloud.com>
Tue, 2 May 2017 04:07:26 +0000 (12:07 +0800)
committerJiaying Ren <jiaying.ren@umcloud.com>
Tue, 2 May 2017 04:07:26 +0000 (12:07 +0800)
Signed-off-by: Jiaying Ren <jiaying.ren@umcloud.com>
src/rgw/rgw_lc.cc

index 403edbd465376e8f9153d3d9ae4fa053f21dabb1..b70d2596f266df1e56cbfe65d844cdd7c8aebf5e 100644 (file)
@@ -2,6 +2,9 @@
 #include <iostream>
 #include <map>
 
+#include <boost/algorithm/string/split.hpp>
+#include <boost/algorithm/string.hpp>
+
 #include "common/Formatter.h"
 #include <common/errno.h>
 #include "auth/Crypto.h"
@@ -197,21 +200,6 @@ bool RGWLC::if_already_run_today(time_t& start_date)
     return false;
 }
 
-static std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
-  std::stringstream ss(s);
-  std::string item;
-  while (std::getline(ss, item, delim)) {
-      elems.push_back(item);
-  }
-  return elems;
-}
-
-static std::vector<std::string> split(const std::string &s, char delim) {
-  std::vector<std::string> elems;
-  split(s, delim, elems);
-  return elems;
-}
-
 int RGWLC::bucket_lc_prepare(int index)
 {
   map<string, int > entries;
@@ -323,7 +311,7 @@ int RGWLC::bucket_lc_process(string& shard_id)
   vector<rgw_bucket_dir_entry> objs;
   RGWObjectCtx obj_ctx(store);
   vector<std::string> result;
-  result = split(shard_id, ':');
+  boost::split(result, shard_id, boost::is_any_of(":"));
   string bucket_tenant = result[0];
   string bucket_name = result[1];
   string bucket_id = result[2];