Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix process_killall. Closes #186.
[simgrid.git] / src / instr / instr_paje_values.cpp
index 066d77f..a0b4a1a 100644 (file)
@@ -15,27 +15,22 @@ simgrid::instr::Value::Value(const char* name, const char* color, simgrid::instr
   if (name == nullptr || father == nullptr){
     THROWF (tracing_error, 0, "can't create a value with a nullptr name (or a nullptr father)");
   }
-  this->ret_          = xbt_new0(Value, 1);
-  this->ret_->name_   = xbt_strdup(name);
-  this->ret_->father_ = father;
-  this->ret_->color_  = xbt_strdup(color);
+  this->name_   = xbt_strdup(name);
+  this->father_ = father;
+  this->color_  = xbt_strdup(color);
 
-  char str_id[INSTR_DEFAULT_STR_SIZE];
-  snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id());
-  this->ret_->id_ = xbt_strdup(str_id);
+  this->id_ = bprintf("%lld", instr_new_paje_id());
 
-  xbt_dict_set(father->values_, name, ret_, nullptr);
-  XBT_DEBUG("new value %s, child of %s", ret_->name_, ret_->father_->name_);
-  LogEntityValue(this->ret_);
+  xbt_dict_set(father->values_, name, this, nullptr);
+  XBT_DEBUG("new value %s, child of %s", name_, father_->name_);
+  LogEntityValue(this);
 };
 
 simgrid::instr::Value::~Value()
 {
-  /* FIXME: this should be cleanable
-  xbt_free(name);
-  xbt_free(color);
-  xbt_free(id);
-  */
+  xbt_free(name_);
+  xbt_free(color_);
+  xbt_free(id_);
 }
 
 simgrid::instr::Value* simgrid::instr::Value::get_or_new(const char* name, const char* color,
@@ -46,8 +41,7 @@ simgrid::instr::Value* simgrid::instr::Value::get_or_new(const char* name, const
     ret = Value::get(name, father);
   }
   catch(xbt_ex& e) {
-    Value rett(name, color, father);
-    ret = rett.ret_;
+    ret = new Value(name, color, father);
   }
   return ret;
 }