From 3b5f09b6c20e6494719fdcc368d97d903084b768 Mon Sep 17 00:00:00 2001 From: zhang Shaowen Date: Fri, 18 Oct 2019 14:25:19 +0800 Subject: [PATCH] rgw: use std::optional instead of boost::optional Signed-off-by: zhang Shaowen (cherry picked from commit 7c85903cbe4321a6a8dff5254225b33e05e3bbd5) --- src/rgw/rgw_lc.cc | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 5706059d32371..c6a0dd70c5ce7 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -1980,15 +1980,15 @@ bool s3_multipart_abort_header( return false; } /* catch */ - boost::optional abort_date_tmp; - boost::optional rule_id_tmp; + std::optional abort_date_tmp; + std::optional rule_id_tmp; const auto& rule_map = config.get_rule_map(); for (const auto& ri : rule_map) { const auto& rule = ri.second; - auto& id = rule.get_id(); - auto& filter = rule.get_filter(); - auto& prefix = filter.has_prefix()?filter.get_prefix():rule.get_prefix(); - auto& mp_expiration = rule.get_mp_expiration(); + const auto& id = rule.get_id(); + const auto& filter = rule.get_filter(); + const auto& prefix = filter.has_prefix()?filter.get_prefix():rule.get_prefix(); + const auto& mp_expiration = rule.get_mp_expiration(); if (!rule.is_enabled()) { continue; } @@ -1996,11 +1996,10 @@ bool s3_multipart_abort_header( continue; } - boost::optional rule_abort_date; - const LCExpiration& rule_abort_multipart =mp_expiration; - if (rule_abort_multipart.has_days()) { - rule_abort_date = boost::optional( - mtime + make_timespan(rule_abort_multipart.get_days()*24*60*60)); + std::optional rule_abort_date; + if (mp_expiration.has_days()) { + rule_abort_date = std::optional( + mtime + make_timespan(mp_expiration.get_days()*24*60*60)); } // update earliest abort date @@ -2008,8 +2007,8 @@ bool s3_multipart_abort_header( if ((! abort_date_tmp) || (*abort_date_tmp > *rule_abort_date)) { abort_date_tmp = - boost::optional(rule_abort_date); - rule_id_tmp = boost::optional(id); + std::optional(rule_abort_date); + rule_id_tmp = std::optional(id); } } } -- 2.39.5