Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
instr: prefer std::str to char*
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 21 Sep 2017 23:08:47 +0000 (01:08 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 27 Sep 2017 19:33:42 +0000 (21:33 +0200)
src/instr/instr_paje_trace.cpp
src/instr/instr_private.h

index d65b5b4..3e7c282 100644 (file)
@@ -763,11 +763,6 @@ void simgrid::instr::ResetStateEvent::print()
   }
 }
 
-simgrid::instr::StartLinkEvent::~StartLinkEvent()
-{
-  free(value_);
-  free(key_);
-}
 simgrid::instr::StartLinkEvent::StartLinkEvent(double timestamp, container_t container, Type* type,
                                                container_t sourceContainer, const char* value, const char* key)
     : StartLinkEvent(timestamp, container, type, sourceContainer, value, key, -1)
@@ -779,14 +774,14 @@ simgrid::instr::StartLinkEvent::StartLinkEvent(double timestamp, container_t con
     : container_(container)
     , type_(type)
     , sourceContainer_(sourceContainer)
-    , value_(xbt_strdup(value))
-    , key_(xbt_strdup(key))
+    , value_(value)
+    , key_(key)
     , size_(size)
 {
   eventType_            = PAJE_StartLink;
   this->timestamp_      = timestamp;
 
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f, value:%s", __FUNCTION__, (int)eventType_, this->timestamp_, this->value_);
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f, value:%s", __FUNCTION__, (int)eventType_, this->timestamp_, this->value_.c_str());
 
   insert_into_buffer (this);
 }
index a748d30..c952056 100644 (file)
@@ -222,12 +222,11 @@ class StartLinkEvent : public PajeEvent  {
   Container* container_;
   Type* type_;
   Container* sourceContainer_;
-  char* value_;
-  char* key_;
+  std::string value_;
+  std::string key_;
   int size_;
 
 public:
-  ~StartLinkEvent();
   StartLinkEvent(double timestamp, Container* container, Type* type, Container* sourceContainer, const char* value,
                  const char* key);
   StartLinkEvent(double timestamp, Container* container, Type* type, Container* sourceContainer, const char* value,