From 0211d1ab2c25ca2e69a7f3c1ef4b6aa1b54185ca Mon Sep 17 00:00:00 2001 From: Jiaying Ren Date: Tue, 2 May 2017 12:07:26 +0800 Subject: [PATCH] rgw: lc cleanup homebrewed split with boost::split Signed-off-by: Jiaying Ren --- src/rgw/rgw_lc.cc | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 403edbd46537..b70d2596f266 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -2,6 +2,9 @@ #include #include +#include +#include + #include "common/Formatter.h" #include #include "auth/Crypto.h" @@ -197,21 +200,6 @@ bool RGWLC::if_already_run_today(time_t& start_date) return false; } -static std::vector &split(const std::string &s, char delim, std::vector &elems) { - std::stringstream ss(s); - std::string item; - while (std::getline(ss, item, delim)) { - elems.push_back(item); - } - return elems; -} - -static std::vector split(const std::string &s, char delim) { - std::vector elems; - split(s, delim, elems); - return elems; -} - int RGWLC::bucket_lc_prepare(int index) { map entries; @@ -323,7 +311,7 @@ int RGWLC::bucket_lc_process(string& shard_id) vector objs; RGWObjectCtx obj_ctx(store); vector 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]; -- 2.47.3