Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use std::string.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 25 Apr 2022 09:43:04 +0000 (11:43 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 25 Apr 2022 11:00:38 +0000 (13:00 +0200)
src/dag/loaders.cpp

index c697e9e..071e446 100644 (file)
@@ -196,17 +196,17 @@ std::vector<ActivityPtr> create_DAG_from_dot(const std::string& filename)
   /* Create all the nodes */
   Agnode_t* node = nullptr;
   for (node = agfstnode(dag_dot); node; node = agnxtnode(dag_dot, node)) {
-    char* name    = agnameof(node);
+    const std::string name = agnameof(node);
     double amount = atof(agget(node, (char*)"size"));
 
     if (activities.find(name) == activities.end()) {
-      XBT_DEBUG("See <Exec id = %s amount = %.0f>", name, amount);
+      XBT_DEBUG("See <Exec id = %s amount = %.0f>", name.c_str(), amount);
       act = Exec::init()->set_name(name)->set_flops_amount(amount)->vetoable_start();
-      activities.insert({std::string(name), act});
-      if (strcmp(name, "root") && strcmp(name, "end"))
+      activities.insert({name, act});
+      if (name != "root" && name != "end")
         dag.push_back(act);
     } else {
-      XBT_WARN("Exec '%s' is defined more than once", name);
+      XBT_WARN("Exec '%s' is defined more than once", name.c_str());
     }
   }
   /*Check if 'root' and 'end' nodes have been explicitly declared.  If not, create them. */