From: Kefu Chai Date: Sun, 27 Oct 2019 01:43:39 +0000 (+0800) Subject: mon/OSDMonitor: use initializer_list<> for {si,iec}_options X-Git-Tag: v15.1.0~1137^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=48bf1c9bf3db6342c970abef9a4492e3e015f84f;p=ceph-ci.git mon/OSDMonitor: use initializer_list<> for {si,iec}_options * use initializer_list<> for {si,iec}_options, no need to uset set<> * remove the comments, the variable names are self-documented. Signed-off-by: Kefu Chai --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 24a4cb00d77..b15eb8e6873 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -7860,14 +7860,11 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap, int64_t uf = 0; // micro-f cmd_getval(cct, cmdmap, "val", val); - // create list of properties that use SI units - std::set si_items = {"target_max_objects"}; - // create list of properties that use IEC units - std::set iec_items = {"target_max_bytes", "target_size_bytes"}; - - if (si_items.count(var)) { + auto si_options = {"target_max_objects"}; + auto iec_options = {"target_max_bytes", "target_size_bytes"}; + if (count(begin(si_options), end(si_options), var)) { n = strict_si_cast(val.c_str(), &interr); - } else if (iec_items.count(var)) { + } else if (count(begin(iec_options), end(iec_options), var)) { n = strict_iec_cast(val.c_str(), &interr); } else { // parse string as both int and float; different fields use different types.