From 48bf1c9bf3db6342c970abef9a4492e3e015f84f Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 27 Oct 2019 09:43:39 +0800 Subject: [PATCH] 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 --- src/mon/OSDMonitor.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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. -- 2.39.5