Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
more use of get_unique_data
authorFred Suter <suterf@ornl.gov>
Mon, 19 Jun 2023 12:13:20 +0000 (08:13 -0400)
committerFred Suter <suterf@ornl.gov>
Mon, 19 Jun 2023 12:13:36 +0000 (08:13 -0400)
examples/cpp/io-file-system/s4u-io-file-system.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp

index ef57282..40e0048 100644 (file)
@@ -58,9 +58,8 @@ public:
 
     // Test attaching some user data to the file
     file->set_data(new std::string("777"));
-    const auto* file_data = file->get_data<std::string>();
+    auto file_data = file->get_unique_data<std::string>();
     XBT_INFO("User data attached to the file: %s", file_data->c_str());
-    delete file_data;
 
     // Close the file
     file->close();
index 351c4e4..8170ff0 100644 (file)
@@ -76,12 +76,11 @@ static void get_set_disk_data(simgrid::s4u::Disk* disk)
 {
   XBT_INFO("*** GET/SET DATA for disk: %s ***", disk->get_cname());
 
-  const std::string* data = disk->get_data<std::string>();
+  auto data = disk->get_unique_data<std::string>();
   XBT_INFO("Get data: '%s'", data ? data->c_str() : "No User Data");
   disk->set_data(new std::string("Some data"));
-  data = disk->get_data<std::string>();
+  data = disk->get_unique_data<std::string>();
   XBT_INFO("  Set and get data: '%s'", data->c_str());
-  delete data;
 }
 
 static void dump_platform_disks()