]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rbd_mirror: build without "using namespace std"
authorKefu Chai <kchai@redhat.com>
Wed, 11 Aug 2021 03:41:42 +0000 (11:41 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 13 Aug 2021 01:33:14 +0000 (09:33 +0800)
* add "std::" prefix in headers
* add "using" declarations in .cc files.

so we don't rely on "using namespace std" in one or more included
headers.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/tools/rbd_mirror/ClusterWatcher.cc
src/tools/rbd_mirror/ImageMap.cc
src/tools/rbd_mirror/Mirror.cc
src/tools/rbd_mirror/Throttler.cc
src/tools/rbd_mirror/main.cc

index 2ae1306be5a3dde6cddc8b2f7b0a5e58577fe315..8bafb336e8e65c3352413ccbfa88e6e1381bc215 100644 (file)
@@ -20,6 +20,7 @@
 
 using std::list;
 using std::map;
+using std::pair;
 using std::set;
 using std::string;
 using std::unique_ptr;
index 4493e073b98bc9a0827d369fa585b48184866a84..b73e090afadaea382a62780c0db5f79819d7bbc8 100644 (file)
@@ -20,6 +20,8 @@
 #define dout_prefix *_dout << "rbd::mirror::ImageMap: " << this << " " \
                            << __func__ << ": "
 
+using namespace std;
+
 namespace rbd {
 namespace mirror {
 
index f02cfe65df56868780b0d407b0c51037a1c53a26..38f35edcd440356db3a1f1731791fcadfc73acb8 100644 (file)
@@ -553,6 +553,7 @@ void Mirror::run()
 {
   dout(20) << "enter" << dendl;
 
+  using namespace std::chrono_literals;
   utime_t next_refresh_pools = ceph_clock_now();
 
   while (!m_stopping) {
index b2029896390c2f7ada198a0df991d927f608e91a..07d6e397ec66dbe5e4331648c29d09586a5a7d9a 100644 (file)
@@ -228,7 +228,7 @@ const char** Throttler<I>::get_tracked_conf_keys() const {
 
 template <typename I>
 void Throttler<I>::handle_conf_change(const ConfigProxy& conf,
-                                      const set<string> &changed) {
+                                      const std::set<std::string> &changed) {
   if (changed.count(m_config_key)) {
     set_max_concurrent_ops(conf.get_val<uint64_t>(m_config_key));
   }
index ab350a014cf8030e254f49543a3e76c35598aa99..78f3a5c2eb6caab865dfad9756cc4d93e4bff5d9 100644 (file)
@@ -37,7 +37,7 @@ int main(int argc, const char **argv)
   std::vector<const char*> args;
   argv_to_vec(argc, argv, args);
   if (args.empty()) {
-    cerr << argv[0] << ": -h or --help for usage" << std::endl;
+    std::cerr << argv[0] << ": -h or --help for usage" << std::endl;
     exit(1);
   }
   if (ceph_argparse_need_usage(args)) {