X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5e00312bf86c3868d644b7806cdba0abf23664a4..3362740a9eb3127adc84bf0e7fb49e37d30d056f:/src/surf/surf_interface.cpp diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 76d1f3ef51..b2cedc19f9 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -528,20 +528,11 @@ void Model::updateActionsStateFull(double /*now*/, double /*delta*/) namespace simgrid { namespace surf { -Resource::Resource(Model *model, const char *name) - : name_(xbt_strdup(name)) - , model_(model) +Resource::Resource(Model* model, const char* name, lmm_constraint_t constraint) + : name_(name), model_(model), constraint_(constraint) {} -Resource::Resource(Model *model, const char *name, lmm_constraint_t constraint) - : name_(xbt_strdup(name)) - , model_(model) - , constraint_(constraint) -{} - -Resource::~Resource() { - xbt_free((void*)name_); -} +Resource::~Resource() = default; bool Resource::isOn() const { return isOn_; @@ -565,11 +556,11 @@ Model *Resource::getModel() const { } const char *Resource::getName() const { - return name_; + return name_.c_str(); } bool Resource::operator==(const Resource &other) const { - return strcmp(name_, other.name_); + return name_ == other.name_; } lmm_constraint_t Resource::getConstraint() const {