Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix MC builds
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 28 Oct 2016 18:24:23 +0000 (20:24 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 28 Oct 2016 18:24:27 +0000 (20:24 +0200)
It seems that MC does not love when exceptions are raised.

src/s4u/s4u_host.cpp
src/simgrid/host.cpp

index ed367e8..e7a2c0c 100644 (file)
@@ -20,7 +20,7 @@
 #include "simgrid/s4u/host.hpp"
 #include "simgrid/s4u/storage.hpp"
 
-std::unordered_map<simgrid::xbt::string, simgrid::s4u::Host*> host_list; // FIXME: move it to Engine
+std::unordered_map<std::string, simgrid::s4u::Host*> host_list; // FIXME: move it to Engine
 
 int MSG_HOST_LEVEL = -1;
 int USER_HOST_LEVEL = -1;
@@ -78,11 +78,9 @@ Host* Host::by_name(std::string name)
 }
 Host* Host::by_name_or_null(const char* name)
 {
-  try {
-    return host_list.at(name);
-  } catch (std::out_of_range& e) {
+  if (host_list.find(name) == host_list.end())
     return nullptr;
-  }
+  return host_list.at(name);
 }
 
 Host *Host::current(){
index 09bb732..90034b0 100644 (file)
@@ -16,7 +16,7 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts");
 
-extern std::unordered_map<simgrid::xbt::string, simgrid::s4u::Host*>
+extern std::unordered_map<std::string, simgrid::s4u::Host*>
     host_list; // FIXME: don't dupplicate the content of s4u::Host this way
 
 void sg_host_exit()