Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define simgrid::xbt::Path to manage file names.
[simgrid.git] / src / msg / msg_io.cpp
index 269ae90..11de4c7 100644 (file)
@@ -11,7 +11,7 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_io, msg, "Logging specific to MSG (io)");
 
-SG_BEGIN_DECL()
+extern "C" {
 
 /** @addtogroup msg_file
  * (#msg_file_t) and the functions for managing it.
@@ -358,7 +358,7 @@ msg_error_t MSG_file_rmove (msg_file_t file, msg_host_t host, const char* fullpa
 const char* MSG_storage_get_name(msg_storage_t storage)
 {
   xbt_assert((storage != nullptr), "Invalid parameters");
-  return storage->getName();
+  return storage->getCname();
 }
 
 /** \ingroup msg_storage_management
@@ -478,10 +478,11 @@ void *MSG_storage_get_data(msg_storage_t storage)
 xbt_dict_t MSG_storage_get_content(msg_storage_t storage)
 {
   std::map<std::string, sg_size_t>* content = storage->getContent();
-  xbt_dict_t content_as_dict = xbt_dict_new_homogeneous(xbt_free_f);
+  // Note: ::operator delete is ok here (no destructor called) since the dict elements are of POD type sg_size_t.
+  xbt_dict_t content_as_dict = xbt_dict_new_homogeneous(::operator delete);
 
   for (auto const& entry : *content) {
-    sg_size_t* psize = static_cast<sg_size_t*>(malloc(sizeof(sg_size_t)));
+    sg_size_t* psize = new sg_size_t;
     *psize           = entry.second;
     xbt_dict_set(content_as_dict, entry.first.c_str(), psize, nullptr);
   }
@@ -510,5 +511,4 @@ const char* MSG_storage_get_host(msg_storage_t storage)
   xbt_assert((storage != nullptr), "Invalid parameters");
   return storage->getHost()->getCname();
 }
-
-SG_END_DECL()
+}