From: Fred Suter Date: Mon, 19 Jun 2023 12:13:20 +0000 (-0400) Subject: more use of get_unique_data X-Git-Tag: v3.34~14^2~8 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/54a654d4e11185267e94ee1cbe17c065a8453ccc more use of get_unique_data --- diff --git a/examples/cpp/io-file-system/s4u-io-file-system.cpp b/examples/cpp/io-file-system/s4u-io-file-system.cpp index ef57282804..40e0048e09 100644 --- a/examples/cpp/io-file-system/s4u-io-file-system.cpp +++ b/examples/cpp/io-file-system/s4u-io-file-system.cpp @@ -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(); + auto file_data = file->get_unique_data(); XBT_INFO("User data attached to the file: %s", file_data->c_str()); - delete file_data; // Close the file file->close(); diff --git a/teshsuite/s4u/storage_client_server/storage_client_server.cpp b/teshsuite/s4u/storage_client_server/storage_client_server.cpp index 351c4e4b75..8170ff0f83 100644 --- a/teshsuite/s4u/storage_client_server/storage_client_server.cpp +++ b/teshsuite/s4u/storage_client_server/storage_client_server.cpp @@ -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(); + auto data = disk->get_unique_data(); XBT_INFO("Get data: '%s'", data ? data->c_str() : "No User Data"); disk->set_data(new std::string("Some data")); - data = disk->get_data(); + data = disk->get_unique_data(); XBT_INFO(" Set and get data: '%s'", data->c_str()); - delete data; } static void dump_platform_disks()