From: Kefu Chai Date: Mon, 8 Jan 2018 16:10:26 +0000 (+0800) Subject: mon: s/boost::regex/std::regex/ X-Git-Tag: v13.0.2~575^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=73681795a46a4a3e4339a8fdb16bb899a8940c10;p=ceph.git mon: s/boost::regex/std::regex/ Signed-off-by: Kefu Chai --- diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index e5c331714e95..16e3a069043b 100644 --- a/src/mon/HealthMonitor.cc +++ b/src/mon/HealthMonitor.cc @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "include/assert.h" #include "include/stringify.h" @@ -119,20 +119,20 @@ void HealthMonitor::encode_pending(MonitorDBStore::TransactionRef t) pending_health.merge(p.second); } for (auto &p : pending_health.checks) { - p.second.summary = boost::regex_replace( + p.second.summary = std::regex_replace( p.second.summary, - boost::regex("%hasorhave%"), + std::regex("%hasorhave%"), names[p.first].size() > 1 ? "have" : "has"); - p.second.summary = boost::regex_replace( + p.second.summary = std::regex_replace( p.second.summary, - boost::regex("%names%"), stringify(names[p.first])); - p.second.summary = boost::regex_replace( + std::regex("%names%"), stringify(names[p.first])); + p.second.summary = std::regex_replace( p.second.summary, - boost::regex("%plurals%"), + std::regex("%plurals%"), names[p.first].size() > 1 ? "s" : ""); - p.second.summary = boost::regex_replace( + p.second.summary = std::regex_replace( p.second.summary, - boost::regex("%isorare%"), + std::regex("%isorare%"), names[p.first].size() > 1 ? "are" : "is"); } diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index e92538ff6fa9..53bac5d8ce87 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -12,9 +12,9 @@ * */ +#include #include #include -#include #include "MDSMonitor.h" #include "FSCommands.h" @@ -232,21 +232,21 @@ void MDSMonitor::encode_pending(MonitorDBStore::TransactionRef t) } pending_fsmap.get_health_checks(&new_checks); for (auto& p : new_checks.checks) { - p.second.summary = boost::regex_replace( + p.second.summary = std::regex_replace( p.second.summary, - boost::regex("%num%"), + std::regex("%num%"), stringify(p.second.detail.size())); - p.second.summary = boost::regex_replace( + p.second.summary = std::regex_replace( p.second.summary, - boost::regex("%plurals%"), + std::regex("%plurals%"), p.second.detail.size() > 1 ? "s" : ""); - p.second.summary = boost::regex_replace( + p.second.summary = std::regex_replace( p.second.summary, - boost::regex("%isorare%"), + std::regex("%isorare%"), p.second.detail.size() > 1 ? "are" : "is"); - p.second.summary = boost::regex_replace( + p.second.summary = std::regex_replace( p.second.summary, - boost::regex("%hasorhave%"), + std::regex("%hasorhave%"), p.second.detail.size() > 1 ? "have" : "has"); } encode_health(new_checks, t); diff --git a/src/mon/MonCap.cc b/src/mon/MonCap.cc index 094a3332248a..f40b9d666919 100644 --- a/src/mon/MonCap.cc +++ b/src/mon/MonCap.cc @@ -26,8 +26,8 @@ #include "common/Formatter.h" #include +#include -#include #include "include/assert.h" static inline bool is_not_alnum_space(char c) @@ -340,12 +340,14 @@ mon_rwxa_t MonCapGrant::get_allowed(CephContext *cct, return 0; break; case StringConstraint::MATCH_TYPE_REGEX: - { - boost::regex pattern( - p->second.value, boost::regex::extended | boost::regex::no_except); - if (pattern.empty() || !boost::regex_match(q->second, pattern)) + try { + std::regex pattern( + p->second.value, std::regex::extended); + if (!std::regex_match(q->second, pattern)) return 0; - } + } catch(const std::regex_error&) { + return 0; + } break; default: break;