Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Use RAII std::vector for s_mc_comm_pattern::data
[simgrid.git] / src / mc / mc_comm_pattern.h
index 1fd9774..fb3de15 100644 (file)
@@ -11,6 +11,7 @@
 #include <cstring>
 
 #include <string>
+#include <vector>
 
 #include <simgrid_config.h>
 #include <xbt/dynar.h>
@@ -32,8 +33,7 @@ typedef struct s_mc_comm_pattern{
   const char *src_host = nullptr;
   const char *dst_host = nullptr;
   std::string rdv;
-  ssize_t data_size = 0;
-  void *data = nullptr;
+  std::vector<char> data;
   int tag = 0;
   int index = 0;
 
@@ -41,10 +41,6 @@ typedef struct s_mc_comm_pattern{
   {
     std::memset(&comm_addr, 0, sizeof(comm_addr));
   }
-  ~s_mc_comm_pattern()
-  {
-    xbt_free(this->data);
-  }
 
   // No copy:
   s_mc_comm_pattern(s_mc_comm_pattern const&) = delete;