Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use (const) references with range-based for loops.
[simgrid.git] / teshsuite / s4u / storage_client_server / storage_client_server.cpp
index 4e44320..df64ea9 100644 (file)
@@ -14,7 +14,7 @@ static void display_storage_properties(simgrid::s4u::Storage* storage)
   if (not props->empty()) {
     XBT_INFO("\tProperties of mounted storage: %s", storage->getName());
 
-    for (auto elm : *props) {
+    for (auto const& elm : *props) {
       XBT_INFO("    %s->%s", elm.first.c_str(), elm.second.c_str());
     }
   } else {
@@ -63,7 +63,7 @@ static void display_storage_content(simgrid::s4u::Storage* storage)
   XBT_INFO("Print the content of the storage element: %s", storage->getName());
   std::map<std::string, sg_size_t>* content = storage->getContent();
   if (not content->empty()) {
-    for (auto entry : *content)
+    for (auto const& entry : *content)
       XBT_INFO("\t%s size: %llu bytes", entry.first.c_str(), entry.second);
   } else {
     XBT_INFO("\tNo content.");
@@ -94,7 +94,7 @@ static void dump_platform_storages()
 {
   std::map<std::string, simgrid::s4u::Storage*>* storages = simgrid::s4u::allStorages();
 
-  for (auto storage : *storages) {
+  for (auto const& storage : *storages) {
     XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->getHost()->getCname());
     storage.second->setProperty("other usage", "gpfs");
   }
@@ -105,7 +105,7 @@ static void storage_info(simgrid::s4u::Host* host)
 {
   XBT_INFO("*** Storage info on %s ***", host->getCname());
 
-  for (auto elm : host->getMountedStorages()) {
+  for (auto const& elm : host->getMountedStorages()) {
     const char* mount_name         = elm.first.c_str();
     simgrid::s4u::Storage* storage = elm.second;
     XBT_INFO("\tStorage name: %s, mount name: %s", storage->getName(), mount_name);